The Laravel ecosystem is currently one of the most popular solutions in the PHP world. The original Laravel library has gone from being a simple library to a complete organization of libraries and associated services. Once you start implementing a part of Laravel, you fall into the rabbit hole, and you never know how much Laravel technology you are going to adopt. In addition to the basic set of services, the common practice at Laravel often associates other well-known technologies such as Redis, Vue.js or Tailwind CSS.

For starters, Lumen is the micro-framework created by the Laravel team as the lightest flavor of the platform. It comes with a minimum set of features. After implementing the base package, you are free to adopt any of the other Laravel packages or services. For more information about Lumen:

To begin with Laravel Lumen on Joomla

Why Laravel Lumen on Joomla?

The Lumen microframework provides an agnostic API, independent of a specific CMS, to access the complete platform of Laravel libraries and integrated services. In our case, we started to implement Lumen as the basis of a family of packages for Joomla, PrestaShop, and WordPress. In our systems, the core business model is implemented following Laravel practices, other top layers are developed as needed, and the lower layer interacts with the underlying CMS to integrate functionality where needed.

Laravel evolves rapidly, and each version implements the latest PHP features available. Laravel 5.8 is the latest version, compatible with 7.1 or higher. Laravel 5.5 is the latest version of LTS, supported until August 30, 2020. Laravel 5.4 was the last version compatible with the PHP 5 branch (no longer supported). In September 2019, Laravel 6 was released. For more information about Laravel versions:

Being Eloquent on Joomla

The Eloquent ORM (included with Laravel) provides a simple implementation of the ActiveRecord pattern to work with the database. It is the cornerstone of the architecture and the first step to understanding the Laravel philosophy. The Query Builder is remarkably similar to the Joomla Query Builder, so the use sounds familiar and feels like the natural first step for an integration project. Eloquent is in full evolution, implementing new functionalities. For example, one of the notable new features of Laravel 6 for Eloquent is the improved subqueries support:

Beyond Arrays, Collections

In PHP, the use of arrays requires a variety of language features, properties, methods, functions and objects, the result of the odd evolution of PHP. To simplify all this complexity, Laravel has Collections. This library provides a consistent and powerful vision for data management. As an example of the possibilities, in Laravel 6, the collections library has incorporated batch processing:

A basic component integrating Lumen

To start implementing a new stack in Joomla, the initial step is to identify what we really need to use. Let's start with a component to integrate Laravel Lumen.

In Joomla, a basic component only needs to implement one file, the entry point. In our case, to create an "XT Lumen" component, then you only have to include a file named as the component. For example, xtlumen.php. Within this file, you only need to initialize the Laravel application and render content. If you invoke the component manually with, you get the output generated by the component.

To illustrate the concept I have created the project anibalsánchez/laravel-lumen-boilerplate-for-joomla

This extension installs a component and uses Lumen to produce a "Hello Joomla" view from Blade, in the backend or in the frontend. To start, you can download and install the extension here:

Beyond the first steps

After these steps, a world of possibilities opens up, and surely many more questions about how to combine the two platforms. With the previous package, Laravel Lumen is already correctly initialized and working in the context of Joomla to generate an output. From this proof of concept, it is possible to advance in the definition of the Routing, Middleware, Views, Models, Service Providers, and the container.

Simplicity is the ultimate sophistication.






Aníbal Sánchez - Perdido y Encontrado en la Computación

Aníbal Sánchez

  • PHP-Prefixer / Product Manager
  • PHP-Prefixer is an automated online service powered by a complex rule-based system to apply prefixes to Composer dependencies.
  • Extly Tech / Team Leader
  • Empower your project with our web solutions. Today, working on Laravel, Amazon AWS, and Ionic. A Joomla Volunteer.

Follow @anibalsanchez

Aikido Manual Aetaiki - Aikikai