187
votes

I read the documentation and it seems Lumen is Laravel with less features. I must be missing something. I am looking for a comparison table of the components and features of both Laravel and Lumen. Does anyone know the differences?

6
That doesn't seem right. Laravel is a full-featured framework where as Lumen is touted as a micro-framework derived from Laravel by sacrificing some of it's configurability and extensibility.fijas
Lumen is pretty much Laravel with less features. That's the point.Frank

6 Answers

197
votes

Update (5.2)

With the latest version of Lumen (5.2) the Microframework focuses on Stateless APIs.
The documentation states:

Lumen 5.2 represents a shift on slimming Lumen to focus solely on serving stateless, JSON APIs. As such, sessions and views are no longer included with the framework. If you need access to these features, you should use the full Laravel framework.


Original answer (<= 5.1)

Lumen is all about speed. It's faster and can handle more requests per second than Laravel.

Laravel is a framework that glues together a lot of components (3rd party and Laravels own components). Now Lumen makes use of a lot of the same components, but strips down the bootstrapping process to a minimum. You could say it is a "different glue", the components (and therefore a lot of the features) are mostly the same.

The performance improvement is achieved by taking away some of the flexibility of the framework in terms of configuration and altering the default boot process.

Besides that, more features are disabled by default and have to be activated before they can be used. As an example: Facades (like DB::table())
You first need to uncomment this line in bootstrap/app.php to enable them:

// $app->withFacades();

The same goes for Dotenv environment files and Eloquent.

For routing Lumen uses nikic/FastRoute instead of symfonys router because it performs a lot better and gives the micro-framework another big boost.

Other than that pretty much everything is the same as in Laravel.

Good reads on Lumen

47
votes

Lumen is not designed to replace Laravel, rather, it is a more specialized (and stripped-down) framework designed for micro-services and APIs. It took away unneeded features for an API such as HTTP sessions and cookies, and also limited the number of configuration options. Out-of-the-box, Lumen sacrified the flexibility of Laravel for speed.

However, you can add Laravel components to Lumen to extend it, so it can be used for more than just micro-services and API. However, if your goal is to extend Lumen to become a website, you might as well use Laravel instead.

They also have different use cases. Lumen and Laravel are meant to work together. For APIs and services are frequently get called, use Lumen. For user-facing applications, use Laravel.


This answer is taken from a blog post I wrote that explains the difference between Lumen and Laravel.

14
votes

Quote from Matt Stauffer

Lumen has the same foundation as Laravel, and many of the same components. But Lumen is built for microservices, not so much for user-facing applications (although it can be used for anything.) As such, frontend niceties like Bootstrap and Elixir and the authentication bootstrap and sessions don't come enabled out of the box, and there's less flexibility for extending and changing the bootstrap files.

You can read more here

4
votes

Lumen microframework is a lightweight version of Laravel full-stack framework. Lumen use the Laravel syntax and components, and can be 'upgrade' easily to Laravel.

Lumen is a more specialized (and stripped-down) framework designed for Microservices development and API development. So, some of the features in Laravel such as HTTP sessions, cookies, and templating are not needed and Lumen takes them away, keeping what's essential - routing, logging, caching, queues, validation, error handling and a couple of others.

1
votes

Why Lumen ?

Lumen is the perfect solution for building Laravel based micro-services and blazing fast APIs. In fact, it's one of the fastest micro-frameworks available. It has never been easier to write stunningly fast services to support your Laravel applications. Doc

Lumen is a framework to build APIs, which will essentially serve JSON responses for your requests. That's it.

These kinds of applications are known as web services in general.

As of Lumen 5.2 update, it doesn't support laravel views, sessions etc... for that you will have to upgrade to full laravel framework.

Some components of the Laravel framework is swapped with other packages in favour of performance. check them here

Example scenarios where we can consider Lumen

  • You might want to open up some features of an application to other developers via API
  • Your application needs to support both web and mobile application, then it will be perfect to store the data in a DB wrapped in Lumen API.
  • When you consider scalability as an important point, you may need lumen
-3
votes

The main difference between laravel and lumen is, Laravel can have artisan commands, which lumen doesn't have.