Skip to main content

Lumen – A Magnificently Fast Micro-service PHP Framework – Part I

Lumen-Laravel-A-magnificently-fast-microservice-PHP-framework-Part-I


Lumen was created by Taylor Otwell in 2015 who was also the founder of Laravel framework. It is a PHP based micro-service framework. It is an open-source php framework. Lumen is designed for building very fast micro-services and APIs.

Lumen is a “micro-framework”, meaning it’s a minor, speedy, leaner version of a full web application framework. It is basically built for more speed, it is faster than similar PHP micro-service frameworks such as Slim & Silex.

Based on the benchmark tests by Taylor Otwell – the creator of Laravel framework, Lumen is the fastest micro framework followed by Slim then Silex.
Lumen – 1,700 requests per second
Slim – 1,250 requests per second
Silex – 950 requests per second

Please Note: The results mentioned above are of slim version 3. The Slim micro framework version 3 has not been released officially. But the results of the slim framework version 2 are quite close to the results of Lumen.

Some Important Features of Lumen Laravel
~
Lumen Laravel is blazing speedy.

~ Lumen has simple syntax.

~ It can be easily upgraded to the full Laravel project.

~ It can handle more requests per second than Laravel framework.

~ Routing: Lumen gives fastest routing feature by Fast Route. Fast Route is a library which provides  fastest implementation of a regular expression based router.

~ Events: Lumen event provides a simple observer implementation which allows us to subscribe and listen to events in our application.

~ Authentication: A session state is not supported by Lumen. Stateless mechanism such as tokens are used for authentication process.

~ Caching: Same as Laravel, Lumen supports caching feature. No more difference in caching feature of Laravel and Lumen. In Lumen, Cache drivers such as Database, Memcached, and Redis are supported.

~ Errors and Logging: Lumen gives a Monolog library, which provides support for various log handlers.


~ Queuing: Lumen provides a queuing service which is same as Laravel’s queuing service.


Difference between Laravel & Lumen
1. Laravel is a web based framework with significant, classic syntax. And Lumen is a stunningly fast micro-service framework based on PHP for building web applications with classic and significant syntax.

2. Lumen is a more specialized and stripped-down framework developed for Micro-services development and API development. So, many of the features in Laravel such as HTTP sessions, cookies, and templating are not required and Lumen takes them away, keep only which is essential – routing, logging, caching, queues, validation, error handling and a some of others.

Lumen Key Requirements
For Lumen, you will need to make sure your server matches with the following necessary requirements.

~ Make sure PHP is installed on your machine. Some of the PHP extensions such as OpenSSL, PDO and Mbstring are required for installing Lumen.

~ Composer: Go to the composer website and install it on your machine. Composer is required to install dependencies of Lumen framework.


~ Database concepts and working knowledge of PHP is also required.

Installation
There are two ways to create Lumen project:
1. Via Lumen installer
2. Via Composer Create-Project

Via Lumen Installer
First, download the Lumen installer using Composer:
~ Composer global require “Laravel/Lumen-installer”
Once installed, the Lumen new command will create a fresh Lumen installation in the directory you specify.

~ This method is more faster than installing via Composer: Lumen new blog.

Via Composer Create-Project
~ Now one can even install Lumen by issuing the Composer create-project command in your terminal:
composer create-project –prefer-dist Laravel/Lumen blog

Serving Your Application
~ php -S localhost:8000 -t public

Why not choose Lumen
~
Unlike the Laravel framework, Lumen is not as configurable. The full-stack Laravel framework has multiple configuration files while in Lumen, each configuration option for Lumen framework is saved in a single .env configuration file.

~ Lumen does not use Symfony’s Routing component. Instead, Fast Route is used for better performance. If you require Symfony Routing features like sub-domain routing or optional parameters, you should use the full Laravel framework.

~ Syntax – If you don’t like Laravel coding then you’re not going to adopt Lumen.

~ Limited adoption – The ratio of Laravel to Lumen Shifts is pretty staggering – about 500 to 1. The Laravel Framework currently has around 20M downloads, while the Lumen Framework has around 125k. So that ratio is 160 to 1.

~ Less focus – Lumen laravel has a very lesser feature set. Lumen caters strictly to API development. So sometimes developer finds it restricted.

~ If a project is already implemented with another framework other than Laravel, it would be better to use another micro-framework for micro-services instead of Lumen.


Conclusion
So, Lumen PHP micro framework is a new PHP micro framework from Laravel that you can use to create powerful APIs and API based web applications. As described you can easily install Lumen laravel. Projects created using Lumen can be easily converted into Laravel projects without changing a thing. This is the 1st Blog in the Series.
Stay Tuned to read Part II!

Source : https://www.9spl.com/blog/lumen-magnificently-fast-micro-service-php-framework-part-1/

Comments

Popular posts from this blog

Automation with SoapUI – Part II

I n the previous article   Automation with SoapUI – Part I , we learned about various features of SoapUI for functionality testing of API services and automating test cases & creating Test Suites. However, the usage of SoapUI is not limited to Functional Testing. SoapUI has amazing abilities for   non-functional testing   like Performance Testing and Security Testing. One of the most important features of SoapUI for performance testing is that we can create complex functionality scenarios and then load test them. This helps test various business scenarios on different loads depending upon usage. In this blog, we will learn the various feature of SoapUI in the Performance Testing domain. Performance Testing can be classified into various categories – 1. Load Testing –  In Load Testing, the Application Under Test (AUT) is subjected to a higher load than its handling capability to test the behavior of the AUT. 2. Stress Testing –  In Stress Testing...

What’s new in Xcode 10

With time technology is moving fast too. This article will provide information about Xcode 10 tool and what is new in Xcode 10 compared to its earlier version. It is beneficial for the developers who like to add new features to their apps. Our experts use the latest tools & technologies to deliver the best to our clients. Xcode 10 is one of the tools we used after thorough testing. 9series always ensures to test all the tools before they use it for your solutions. Below is the synopsis of the blog in case you just want an overview of the same ~  Xcode 10 was announced at WWDC 2018 on 4 June 2018. ~  Xcode 10 includes Swift 4.2 and SDKs for iOS 12, watchOS 5, tvOS 12, and macOS 10.14. ~  Xcode 10 requires a Mac running macOS 10.13.4 or later. ~  It is capable of running multiple simultaneous versions of the Xcode App and any associated tools. The interesting thing about Xcode 10 is that it can coexist with the previous version. Here are the detailed of ...

Impact of Tech Trends on Industries in 2019

Businesses are growing tremendously and the use of technology in almost everything has brought many changes and advancements in it. People are expecting the  next generation technologies 2019  to reshape the future of Industries. Technology is pivotal in every business today, be it e-commerce, banking, retail, manufacturing, healthcare, education, or any other it can be seen everywhere. Let’s take a closer look at how trends will be changing and what possible impacts it might have in 2019 and the coming years. Innovative Customer Service with Advanced Chatbots There is an increased demand for customer support across various industries. You will see a drastic transformation in the way the service industries work with the help of Natural Language Processing. With the advanced technology of Chatbots, companies will be able to provide unique customer services that will make them tough competitors in the market. Advanced chatbots can very easily detect the emotions of th...