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
11
votes
3 answers

How to use Request->all() with Eloquent models

I have a lumen application where I need to store incoming JSON Request. If I write a code like this: public function store(Request $request) { if ($request->isJson()) { $data = $request->all(); $transaction = new…
user3914418
11
votes
2 answers

Class 'Validator' not found in Lumen

try to create validator manually in Lumen. The official documentation is written:
epod
  • 143
  • 2
  • 6
11
votes
1 answer

PHPStorm plugin for Lumen just like Laravel

I found this tutorial to install a plugin for Laravel and have its methods completed by PHPStorm. I does not seem to work for Lumen. Are there any solutions out there that currently support Lumen since Lumen is kind of a subset of Laravel?
AlexW.H.B.
  • 1,781
  • 3
  • 25
  • 50
10
votes
2 answers

Best practice for multiple Vue instances/apps in Laravel

What I want to create is a web application with Laravel Lumen and VueJS, where Laravel Lumen is used for an API and VueJS for a SPA. In the application I want an admin section, a small forum and the website. I want to reuse this concept in future…
10
votes
6 answers

Lumen 5.6 Migrate Error Specified key was too long max key length is 767 bytes

I use Lumen 5.6 and mysql. when i type "php artisan migrate" following error occur: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was t oo long; max key length is 767 bytes (SQL: alter table `users` add unique ` …
Babak no'doust
  • 631
  • 7
  • 18
10
votes
6 answers

How to create symlink for storage public folder for Lumen

I have used the following command to create symnlink for storage public folder for my project which I'm doing in Lumen . => php artisan storage:link But I am getting this error in terminal => There are no commands defined in the "storage"…
Soumik Chakraborty
  • 243
  • 1
  • 2
  • 15
10
votes
2 answers

Lumen call to DB::connection() returns null even though select() is successful

I am using Lumen 5.3.1. $app->withFacades() and $app->withEloquent() have been uncommented in app.php. In web.php I run the following code: $app->get('foo', function () { return app('db')->select("SELECT * FROM foo"); return "Connected…
ebakunin
  • 3,621
  • 7
  • 30
  • 49
10
votes
2 answers

How to apply pagination in Lumen?

How can I make my page paginated so that it shows 10 records/page. I have done this in Laravel but not sure how to do it in Lumen
Volatil3
  • 14,253
  • 38
  • 134
  • 263
9
votes
2 answers

safari - NSPOSIXErrorDomain:100

I created API with PHP and am testing it now. It goes success with chrome and firefox, but safari gets error, "NSPOSIXErrorDomain:100." This error sometime happens and sometime I can get a correct response from API. Does anyone know anything about…
datenshidon
  • 121
  • 2
  • 7
9
votes
1 answer

Lumen access Request object outside controller

I am creating a custom guard where I need to access the Request object in order to get http headers. I have tried request() but it is undefined in lumen. How do I get access to Request object outside of an controller class? Note: Not a duplicate of…
Sisir
  • 2,668
  • 6
  • 47
  • 82
9
votes
4 answers

Check if request input is not null before set the value

I have an API that set user settings. Because neither of inputs are mandatory I want to check first if the value exists and then set it to the model attributes in order to avoid null values. $this->InputValidator->validate($request, [ …
dios231
  • 714
  • 1
  • 9
  • 21
9
votes
1 answer

How to add query parameter to routes in Lumen?

I am trying to know how to add query parameters to routes in Lumen this is an example of a route I created $app->get('/product/{apikey}','ProductController@getProduct'); This works when I use http://api.lumenbased.com/product/10920918 but I…
Rishabh
  • 3,752
  • 4
  • 47
  • 74
9
votes
3 answers

Lumen php artisan config:cache not found

I'm trying out the PHP micro Framework Lumen (from laravel). When I set up Lumen and I try to use the php artisan config:cache command like in Laravel, I get this error : [InvalidArgumentException] There are no commands defined in the "config"…
Ahmed Bermawy
  • 2,290
  • 4
  • 35
  • 42
9
votes
2 answers

Lumen failed to open /../vendor/autoload.php

I started using Lumen upon its release in April. From version 5.0, I already faced this same problem and found a solution (see here). There are some days I proceeded to create a new project in Lumen (5.1). However, by applying the method with the…
w3spi
  • 4,380
  • 9
  • 47
  • 80
8
votes
2 answers

Use DISTINCT in Laravel's withCount() method

With Laravel/Lumen eloquent I can get count relations like this: User::withCount('views')->get(); this will use SQL select `users`.*, (select count(*) from `views` where `users`.`id` = `views`.`user_id`) as `views_count` from `users` and return…
norr
  • 1,725
  • 1
  • 20
  • 33