Questions tagged [lumen]

Lumen is a "micro-framework" built on top of Laravel's components, and is the official micro-framework of Laravel. Lumen is targeted at microservices--small, loosely-coupled components that usually support and enhance a core project.

Lumen is the perfect solution for building based micro-services and blazing fast APIs. In fact, it's one of the fastest micro-frameworks available.

Feature Overview

  • Templating
  • Caching
  • Command Scheduler
  • Controllers
  • Eloquent ORM
  • Error Handling
  • Database Abstraction
  • Dependency Injection
  • Logging
  • Queued Jobs

Documentation

Other notable tags

Community

Other Useful Resources

2610 questions
0
votes
1 answer

Use Lumen framework to insert Chinese character

I am using Lumen framework to provide API for my main site. A URI to insert a tag looks like this: $router->get('/addtag/{id}/{tag}', 'BookController@addTag'); When tag is Chinese, it was inserted into the database encoded: 中文 becomes…
TaylorR
  • 3,746
  • 5
  • 25
  • 42
0
votes
2 answers

How to return json response in Laravel using eloquent without \r\n

I'm using laravel with eloquent and in json response i get \r\n. How can i get rid of them? public function showOneProduct($lng) { return response()->json(Product::where('language', $lng)->get()); } response: [ { "id_produs": 1, …
0
votes
1 answer

Lumen changes table name in query

I'm new to Lumen (ver. 8.3.4) and I got a strange issue during my tests. In my DB I have the table "Pippo"; to query it I created the model App\Models\Pippo and the controller App\Http\Controllers\PippoController.php, that includes the…
Gianluca
  • 139
  • 5
0
votes
1 answer

PHP Fastroute - Handle 404s

In my application I'm using FastRoute and I would like to have different types of 404 responses: When a call is made to a not existing endpoint starting with /api then the application should return a JSON 404 response. When a call is made to a not…
Dan
  • 3,329
  • 2
  • 21
  • 28
0
votes
1 answer

How can I get and print/log the currently installed exact version number of Lumen?

As I mentioned in the Q-title, I want to print/log the currently installed version of Lumen framework i.e. the exact version number of Lumen thro' Bash script in GitBash terminal or PHP snippet in any Model / Controller. I recently upgraded Lumen by…
Vicky Dev
  • 1,893
  • 2
  • 27
  • 62
0
votes
1 answer

Cannot test validation errors in Lumen

When i try to validate controller response using one of the available assertions like assertJsonValidationErrors it gives the following error: Failed to find a validation error in the response for key: 'name' Here is my…
Pezhvak
  • 9,633
  • 7
  • 29
  • 39
0
votes
0 answers

Delete item in array PHP

I'm doing a REST api with Lumen framework. One api call give me all my categories of product : { "categories": [ { "id": 1, "name": "Boissons", "parent": null, "categories": [ …
Bosshoss
  • 783
  • 6
  • 24
0
votes
1 answer

How to query (sql) by listing the sports of the player doesn't belong to?

sports table id sport name 1 basketball 2 volleyball 3 golf 4 baseball players table id sport name 1 michael 2 stephen player sports table id player_id (players.id) sport.id…
0
votes
0 answers

How to Flatten data along with key in Lumen/Laravel

I followed this tutorial. It was worked. How to get json to flatten along with key in lumen/laravel. I need key and value. Code I used: public function index(){ $collection = collect([ 'name' => 'Hardik', 'role' => ['admin',…
Saravanan DS
  • 278
  • 3
  • 14
0
votes
2 answers

How to delete photo from project's public folder before updating data in lumen/laravel?

I am trying to delete photo from my projects public folder before updating another photo. My code looks like- if(File::exist( $employee->avatar)){ //$employee->avatar looks /uploads/avatars/1646546082.jpg and it exist in folder …
0
votes
0 answers

How to use chunk() in Laravel for progress and failure updates?

Laravel Eloquent Model called ProductModel that references a table that contains a large number of rows (i.e. 500,000). Each row contains a product_id that calls the function isValid() which either continues the loop or breaks…
Ryan
  • 1
  • 5
0
votes
1 answer

How do i track an order using laravel lumen?

I'm integrating APIs that will be connected to an E-Commerce platform. I'm supposed to add an option to track orders, how do I do that? Also, there's no frontend yet so I'm using postman to test all the API's. the orders go through different…
Truth
  • 3
  • 3
0
votes
1 answer

Processing events in Lumen from another Laravel project on same DB

I'm working on a Laravel 8 project, and have a Laravel Lumen 8 project sitting along side my Laravel project. Both connect to the same database, and the database has the jobs and failed_jobs table. Ideally, I want to simply dispatch an Event from my…
Ryan H
  • 2,620
  • 4
  • 37
  • 109
0
votes
1 answer

How to implement Depedency Injection correctly when injected service has required constructor argument

I am using Laravel Lumen (v8.2.4) with PHP (v7.4) I have the following controller class:
Mr B
  • 3,980
  • 9
  • 48
  • 74