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

Employee Attrition and Retention – Part 1

Introduction This is the 1st blog in the series in which we are going to discuss the attrition in an organization. An organization is built with teams and the team’s growth is dependent on each employee, but when an employee quits the job, it can disturb a team’s dynamics. Other team members may find themselves scrambled to cover the extra work for weeks, or even for months until a new candidate gets hired. Hence, it becomes important for any organization to work towards retaining the key employees. Reasons Employees Want to Leave Their Jobs Here are some very common reasons that make an employee leave the job based on certain statistics we have collated the best information from various survey & studies to give you a clear picture of where an organization can go wrong and what causes employees to resign. ~  The job wasn’t what they’d expected ~  Lack of coaching or feedback ~  They didn’t get along with the boss ~  Lack of opportunity for career advance...

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...

VUE.JS & Its Features

Nowadays, Application of software development is one of the most popular businesses being practised both at the individual as well as enterprise levels. Various tools and techniques are being used by the developers for launching successful applications. Many software technologies are also being used by the developers to make the applications faster, more attractive and user-friendly among them. Vue.js is one of those new software technologies that are being widely used all over the world for web development. Vue.js is simply a JavaScript framework with various optional tools for building user interfaces. In the age of new javascript frameworks that are component-driven, Vue is distinct by its simplicity and performance. It mainly focuses on the view layer and offers a lot of functionality for the view layer and used for building powerful single-page web apps. Vue.js uses JavaScript ES5 or ES6 while Laravel provides a core library for Vue.js. The ecosystem is vibrant, with more a...