Lwin Maung Maung

My Notes and Blogs

Home Laravel Linux
<-

Laravel vs Lumen, when to use it

Published on  Aug 5th, 2023Updated:  May 23rd, 2024
2 mins Read

Laravel vs Lumen. In API development, the best response time for API response is less than 150ms, according to Hubspot. That means your API response or the programming language you use for your API should be faster than 150ms. You cannot query one or more APIs to get your results finished because you cannot block one request to another.

Laravel is one of the best PHP frameworks. However, according to some benchmarks, Laravel is not fast enough for microservices in earlier times due to many dependencies. To avoid app booting latency, Taylor releases Lumen, a microframework of Laravel which an eloquent built-in disabled.

I have used some for small microservices. However, I chose back to Laravel. This post is my own opinion and experiences about how I moved back to Laravel instead of sticking to Lumen.

Problems with Lumen

Lumen is simply a faster framework. However, Laravel has some sacrifices for its performance. Built-in ORM, eloquent, is disabled. Some libraries stopped, and some changed for performance.

The speed revolution of PHP

During the release of Lumen, PHP is only at 5.5, the gigantic elephant version of PHP. During that time, the elephant needs a diet plan. Laravel and PHP 5.5 are four humans on an elephant. Lumen is like four thin humans instead, or removing a man who doesn't need to sit to enjoy the journey.

After the revolution of PHP, PHP 7 and 8 have a lot faster processing power than PHP 5. Now, Laravel plays more role in API than Lumen. That's why in Laravel 7, the Laravel welcome page dropped Lumen.

Microservices

In the cloud environment, microservice is necessary for scaling horizontally and resource allocations. However, we cannot leave server response time and resource server location without consideration. The geolocation of the services becomes critical for performance. I believe a microservice app serves enough traffic for a specific requirement. It means we don't need it if there is very little traffic.

Conclusion

After monolith and microservices, we can mostly use Laravel instead of Lumen. We can use Laravel in some microservices because we have enough power to handle it. If you have a lion, why get a cat? p.s. I love cats. 

© lwinmaungmaung MMXXIII. All Rights Reserved.