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

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 the new features.

Why Choose Swift Over Objective C?

Dedicating 6 years in improving & using the Objective-C, Apple finally decided to snap another challenge to developers. Again, iOS developers will have to learn this new programming language – Swift. In this article, we are going to look at some points of Swift compared to Objective-C. If you know Objective-C (at least the basics) then this tutorial is best suited to you and want to see what the equivalents are in Swift. So let’s get into it! Swift Language is Easier than the Objective-C: ~  Objective-C has been created using two languages: C and Smalltalk. hence, Objective-C has such a complex, Verbus Syntax. ~  Objective-C obtains its object syntax from Smalltalk while Syntax for the non-objective operations is similarly as C. ~  While the Swift Language is an option to the Objective-C language, the Swift Language is defined as “Objective-C without the C”. ~  Swift is a comparatively a new programming language. Apple started to work on Swift in 2010 and published it to

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