Why we chose Lumen microframework for our application to expose APIs?

We did not want to use a full stack framework such as Laravel, or Symfony because we were using Drupal for the backend. This is a story of our recently developed project the headless project. Using JS framework as a frontend and Drupal as a CMS admin.
The major thing was us to expose API endpoints and didn't  want to use Drupal web services because of Drupal 7 loads bootstrap and unnecessary objects on web services. So we decided to do some research on popular microframeworks of PHP like Slim and Lumen and then these two frameworks put us in dilemma.

So following things helped us to decide a micro-framework -

POC on Research

  • Very first we did a POC on validating API response and found lumen is faster at least 1.8 times then Drupal web service.
  • Lumen is benchmarked at 100/rps (Requests Per Second) faster than Slim v3. (Found on the web).

Easy HTTP Routing system

Lumen provides powerful routing system what maps the route callback to specific HTTP request along with the permission check. You can add pattern matching in the route.

Flexible and extendable Middleware

With Lumen, you can create middleware to modify the HTTP requests and response. For e.g. you want to add some layer before or after if the HTTP calls like authorization or CORS, you can do that as well.

Repositories and Controller

Lumen default supports repositories on the controller, you can create repositories for different modules.

Simple Database Layer

Lumen makes connecting with databases and running queries extremely simple. Currently, Lumen supports four database systems: MySQL, Postgres, SQLite, and SQL Server. You may use the DB_* configuration options in your .env configuration file to configure your database settings, such as the driver, host, username, and password. We have used Lumen with Postgres database. [Optional], Migration is also available even we didn't require it.

Handling Errors & Logging

Error handling is already configured with Lumen with Monolog logging library. Monolog logging can accept your custom configuration.


As Lumen is the Laravel framework and high-performance API microframework, The community is also very good. Most of the things from Laravel are supportive by Lumen and you can easily migrate your Lumen Application to Laravel without changing a single line of code. So it gives a top level of security in the case if the Lumen needs to be replaced with Laravel (will be an easy process).

And the most important thing was one of our team member was Laravel experienced. Which helped us a lot to finalise the awesome micro-framework.

Here is the API doc for Lumen 5.4 - https://lumen.laravel.com/docs/5.4