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
13
votes
2 answers

Lumen - Create database connection at runtime

In a Lumen project, I need to create database connections on runtime, but I keep getting a "Database [...] not configured" error, each time I try to use a recently created connection. This is my test code on routes.php: get('/',…
BernalCarlos
  • 936
  • 3
  • 12
  • 25
13
votes
3 answers

Command "serve" is not defined (Lumen-Laravel)

So, i try to install the lumen restful api. Based on tutorial, i have to "serve" on php artisan. The command be like: php artisan serve sample_api sample_api/public then it shows: Command "serve" not defined. Some say that serve command has been…
apapipip
  • 139
  • 1
  • 1
  • 3
13
votes
1 answer

Does task scheduling in Lumen work just like in Laravel?

You can see task scheduling explained in the latest docs for Laravel, but Lumen's docs do not mention this. However, it looks like Lumen's Console Kernel file has a schedule method just like Laravel. Does scheduling work the same in both, or what…
prograhammer
  • 20,132
  • 13
  • 91
  • 118
13
votes
3 answers

Lumen simple route request doesn't work

I installed Lumen on my web server, but I have problems with routes // http://12.345.678.910/ $app->get('/', function() use ($app) { return "This works"; }); But in this second case he cant find directory //…
Ivan Vulović
  • 2,147
  • 6
  • 27
  • 43
13
votes
3 answers

How to do {{ asset('/css/app.css') }} in Lumen?

In Lumen, I can do this in my blade template: {{ url('/css/app.css') }} In Laravel I could do {{ asset('/css/app.css') }} Is the url helper all I have to work with in Lumen?
prograhammer
  • 20,132
  • 13
  • 91
  • 118
12
votes
2 answers

Method addEagerConstraints does not exist

I have two models, User and Event. I made a pivot table, invitations between User and Event with a status column. In my Event model definition, I wrote this : public function invited() { return $this->belongsToMany(User::class, 'invitations',…
Louis Etienne
  • 1,302
  • 3
  • 20
  • 37
12
votes
2 answers

Laravel Queue Worker Memory Footprint is Too Big :/

I am running a queue worker that connects to six MQs. When it is brought up, it consumes 25MB of RAM. That is with zero jobs on the queue, i.e. the worker is in a sleep state. I use Larvel for all of my projects, this particular project is purely…
mils
  • 1,878
  • 2
  • 21
  • 42
12
votes
2 answers

Laravel : How to send image or file to API

I have an API (created by Lumen) to save an image or file from client side. this is my API code if ($request->hasFile('image')) { $image = $request->file('image'); $fileName = $image->getClientOriginalName(); $destinationPath =…
Code On
  • 213
  • 2
  • 5
  • 13
12
votes
1 answer

Saving many-to-many relationship, sync/attach doesn't exist?

I have two following 2 models in many-to-many relationship : use Illuminate\Database\Eloquent\Model; class Permission extends Model { /** * The database table used by the model. * * @var string */ protected $table =…
Zed
  • 5,683
  • 11
  • 49
  • 81
12
votes
2 answers

Converting a laravel application to lumen

So, I have been building a laravel 5.1 API and after months of work on it it dawned on me that I should have been using Lumen all along. Is there a way to convert a laravel app to a lumen app?
Bill Garrison
  • 2,226
  • 3
  • 34
  • 75
11
votes
1 answer

Lumen generate token without verifying username and password

I am trying to generate token by verifying other fields and table rather than email and password of user table. I am using tymon jwt library. I have three fields that need to be verified to authenticate the user …
user254153
  • 1,855
  • 4
  • 41
  • 84
11
votes
1 answer

Views in Lumen 5.2+

I need to build a small widget, and was planning to use the Lumen for this because I need a quick response and I need components such as routing, translation, requests and views. the problem is noticed now that the views were discontinued after…
Miguel Borges
  • 7,549
  • 8
  • 39
  • 57
11
votes
2 answers

How to create a listener for console commands

I want to run a method when every single console command is run, How do I create a listener for all console commands in lumen? I tried by creating a listener for ConsoleCommandEvent, this event is fired in…
Mohammad Mehdi Habibi
  • 1,601
  • 1
  • 14
  • 30
11
votes
2 answers

AWS Cognito User Authentication

OK. Here is my thing. We are building a small application on top of Lumen/Laravel. We need the user management to be completely taken care by AWS cognito. Basically 2 simple functionalities. Push the user details to AWS cognito user pool upon…
user3227262
  • 563
  • 1
  • 6
  • 16
11
votes
1 answer

laravel / lumen access .env values in middleware

Is there any way to access .env vals from inside of a middleware script? I have tried to do so by env('KEY') but this seems to return null most of the time. Does any one know of a better way to do this inside of middleware or a way to insure the…
Aaron
  • 167
  • 1
  • 1
  • 10