Lumen a micros framework by Laravel | Fonseka Innovations
Lumen – Micro-framework by Laravel

Lumen is a project which was created by Laravel to cater to smaller projects. It is a micro-framework of Laravel which enhances the application to be faster, leaner and to reduce the load from heavy applications. Lumen is widely used at present because it is one of the fastest micro-frameworks in PHP. If you are wondering whether this framework will replace Laravel, it will not as this is a stripped-down framework of Laravel. Lumen is used as a microservice or even as a backend API application. It has all the illuminate components of Laravel such as the database, cache, queues, and all core components, which gave the name ‘Lumen’ as it ‘Illuminates Laravel’. Lumen lets you add any additional libraries of Laravel or any other 3rd parties.

Why use Lumen?

As mentioned above, this has the same core foundation as Laravel, and it contains most of the Laravel’s components. Even though it does not come out of the box like Laravel framework, it lets you tap into Laravel’s core features, such as Routing, Dependency Injection, the Eloquent ORM, Migrations, Queues and Scheduled commands. This framework is mainly for projects and components that can benefit the speed boost by removing flexible components of Laravel.

Lumen mainly targets microservices, which will use to enhance its core application with durability and efficiency. Most applications use this framework as an extra service to complex web applications to divert traffic and to balance the load. It can be used to adjust the server load as it is a light-weight and has a quick response time compared to any other PHP framework.

Benchmark Results for Lumen | Fonseka Innovations
Benchmark results (Higher the number is better)

As shown in the figure above the benchmark results for response time is far better than any other PHP micro-frameworks. Not just that according to Blackfire.io Lumen is 290% faster than Laravel (web) for static pages. The main reason being the session component of Laravel has been removed from Lumen. Therefore when you compare Lumen is 75% faster than Laravel (API).

Lumen for RESTful API

Lumen development and uses | Fonseka Innovations
Lumen for API and Microservices

RESTful API (Representational State Transfer based Application Programming Interface) is mainly a general category describing an HTTP based CRUD (GET, POST, PUT/PATCH, DELETE) method interface. Advantage of having it is that it controls the backend with database transactions with authentication in a maintainable project structure.

I will touch base why Lumen will be a good option for a RESTful API.

  • Response time

As mentioned above, it has stunningly fast response compared to other frameworks.

  • Routes handling

Like Laravel, this controls the routes in a contained manner, and you can group them with access roles, group them with prefixes or even you can version the routes. Read more

  • Message Queueing

Message queueing lets you improve load balancing, scalability and security with API and Worker environments. This utilises the Laravel Queue library to manage the message queueing in the API. Read more

This comes with Authorisation libraries out of the box. We can set authorisation to workers, views and the routes. Unlike Laravel, we will have to define abilities, policies according to the project.

“Authentication is the process of determining whether someone or something is, in fact, who or what it declares itself to be. Authorization is the process of giving someone permission to do or have something.” – Margaret Rouse

Apart from all the main features, we can use error handling, models, controllers, providers similar to Laravel.

Get started. (Installation guide)

As I mentioned above, there are many uses from Lumen. Fonseka Innovations is there to help you integrate, develop APIs, Microservices or even plugins connecting your WordPress websites. We have vast experience with handling projects in Lumen, and you can contact us for more information regarding Lumen projects.

Fonseka Innovations
Fonseka Innovations

 

About the author

Leave a Reply