Why Laravel Will Become The Only One Framework

May 07, 2022 8 minutes read
Photography of Elephant On Road -  Magda Ehlers (pexels.com)

A bold thesis, but there is some truth in it. Laravel changed the approach of many programmers and started something that was previously known to RoR or Django whose motto on the home page is "The web framework for perfectionists with deadlines". Similarly with Laravel, Taylor Otwell (πŸͺ) has set a new direction of development for PHP frameworks, thus breaking the barriers that we have created by creating and adapting solutions from other technologies (such as Java Spring, Hibernate ORM and others).

I would like to emphasize that I don't aim to favor a specific framework, but only to show what the trend is. And for sure PHP community is mainly centered around two frameworks: Laravel and Symfony. That's why I will compare them often.

Before we start. What is the purpose of PHP?

PHP originally stood for Personal Home Page, currently it is a recursive acronym for PHP Hypertext Preprocessor. The initial name (proposed by Rasmus) already indicates the intention of the authors of this language.

In speaking to many developers, it has always been noticeable that Symfony was inspired by Java Spring, Hibernate or others. Thus forgetting that the request in PHP lives (optimistically) for less than a second. The whole party takes about a second and so on and on.

PHP is perfect for creating static pages (including APIs or MVC apps), this language and the entire ecosystem were created this way. Additionally, if we use asynchronous processing with async UI we can create a relatively cheap and easily scalable architecture.

How many PHP frameworks were there?

10, maybe 20, or maybe even more. How many has survived? Some of them. How many frameworks will survive? Who knows, but Laravel will surely survive. At the moment, it is hard for me to imagine in which area the next framework could compete with Laravel. 

With each release the Laravel takes into account trends in the IT such as AWS integration, serverless, SPA, PWA, async processing. Also core team places a strong emphasis on design (UI/UX/DX). So if a new framework were to be created, it would have to have huge financing to convince developers and business people. But as we know from history, PHP frameworks were usually created as a side projects without any big players inside (like IBM - Java, Google - Go, etc).

History repeats itself

If you've heard or used the Zend Framework, you probably remember the constant battle between the Zend Framework developers and the Symfony developers. Lots of useless discussions, sometimes even harsh statements. Have you ever been involved in such a discussion, if so then you know what I mean. And that goes for everything. It's just the way it is. People like to be part of something and identify with it.

I remember the community running away from the Zend Framework after seeing what Symfony was offering them. Zend Framework started to be considered a toolkit, not a framework. Symfony, in turn, as a full-fledged framework that has many features out of the box. It was a complete shift in approach. Additionally, ah those awesome bundles, there were bundle for everything - so Symfony was seen as a brilliant novelty.

However, there was a problem - Symfony didn't care about the newcomers. Yes, that's true. In the early versions of Symfony, it totally didn't care for the newcomers. To understand the authors' ideas in the code, you had to be at least mid-level and spend a few days reading the documentation. Documentation was also not friendly, lack of order and full of chaos. This is how I could describe my experience from many years ago, getting to know Symfony.

The same impressions were also experienced by my students who tried Symfony - usually they said they switch to RoR because of its documentation and ease of use. Now it looks differently, but probably its too late.

The next iteration in this short story is happening right now. Escape from Symfony to Laravel. If you look at the packagist statistics, the number of job offers or the stackoverflow, you may notice that Symfony is in a downward trend. Below are two tables showing the number of installations of both frameworks and versions. Laravel has more installations for latest versions: 8 (2020) and 9 (2022), and Symfony's most popular versions are: 3 (2015) and 4 (2017).

symfony and laravel packagist stats

Laravel's hard times

I have been using Laravel since version 4 and I remember perfectly well how the developers reacted to it and also to Taylor. As a rule, these were repeated statements and complaints about Facades, ORM, or bad performance. Surprisingly, for new users who never touched other frameworks, the opinions were completely different.

Many people criticized Laravel without even giving it a chance. They may have been afraid of losing control of their decision-making life, technology selection, or even loss of job (yes, such a scenario was and is also possible).

Laravel wins

Fortunately, Laravel chose its own path and become the leader in its category. You can see it in the statistics on the packagist or by looking at its competitors that create similar components and tools, they try to adapt what Laravel brought. Symfony openly mentioned it on their blog - e.g. Encore is inspired by Laravel Mix. Even Laravel queue worker also has its counterpart.

This can be summed up by saying that Laravel focused on developers while others focused on architects. But business needs developers, not architects - at least to build your next e-commerce or API.

Laravel has a great DX

Well Developer Experience is an important part of creating an ecosystem. Laravel cares about the community and as you can see it works. Elegant code, good documentation, dozens of built-in features and the frequency of releases, reliability etc. It's like driving the BMW πŸ˜‡.

A long time ago, there was Propel. I think the Propel ORM would be a good competitor to Laravel in terms of DX, but it was only an ORM that solved only one (basically the most important) problem - persistence. But the generally accepted criticism of the Active Record pattern in ORM made using Active Record a faux-pas.

Speaking of DX, I also mean the offline one. A few years ago, Robert C. Martin's performance at Laracon gave to Laravel some reach and credibility. No wonder that the presence of Uncle Bob greatly increased the number of Laravel's downloads on packagist.

A friendly community

Another thing is the Laravel (and ofc the entire PHP community 🐘!) has one of the best community in the world. It's just that everyone who started using Laravel just has a different mindset. They focus on solving problems and not on generating new ones. This is also common in Django projects.

Openness and sharing knowledge has become an axiom. For instance Jeffrey Way has created a Laracasts that allowed many young people and PHP beginners to enter the IT industry and change their lives. It's just awesome πŸ™Œ.

Why business people prefer Laravel

In this consideration, I omit large projects or any XMS (e.g. Pimcore) that use the framework only to provide the implementation of some PSRs. Most applications are small to medium sized projects that scale not with the specific type of ORM, but with the amount of CPU/EC2 instances. And business people will always choose a given framework, as long as the development team will quickly create features and effectively manage changes.

Business doesn't like a developers who spend time thinking about whether Active Record or Data Mapper; or should that model go to namespace Domain\Models or Domain\FeatureX\Models. Those developers with a specific approach, let's call them non-artisans 😎, they like such deliberations and reflections. According to my observations, this is due to:

  • they have an artist's soul or are kind of beginners, and they are afraid of creating anything because of the risk of receiving negative opinions about their work
  • they are still not sure if this is the right way, then we go back to point 1
  • any other idea…?

It's really hard for business people to work with such programmers. Deadlines are often missed and projects collapse due to the enormous architectural overhead that will eventually be re-factored by the next hero.

I am not saying that asking such questions or talking about architecture is wrong. They are good and necessary, but they are not needed when you create another static site, e-commerce, simple API, or just some CRUD. Remember that with each new release of the framework or language, the level of abstraction increases. This means that a lot of boilerplate code migrates down to the lower layers. For instance WebSocket protocol changed a lot, and it brings new opportunities for software developers, but also new expectations (Laravel Echo / Broadcasting).

An interesting example is remoteOK.io - a single file project that earns more than $50,000 a month. Curious if they have separate Bounded Contexts?

Closing notes

I wish each project successes and great communities. I really appreciate all open source projects. They make a huge contribution to the development of technology at every level. However, change is inevitable. But always the achievements of the predecessors contribute to the new, such as team play.

As a summary, I encourage you to check the PHP timeline prepared by JetBrains. It presents the most important dates in the PHP ecosystem in an awesome way - they prepared it for the 25th Anniversary of PHP. And many thanks to all who put their efforts in initiating the PHP Foundation.

Hope you liked the article! Greetings

Disclaimer: The opinions expressed here are my own and do not necessarily represent those of current or past employers.
Comments (0)