Which is the best PHP framework in 2021?

Too many PHP frameworks out there and it is too much of a confusion isn’t it it? It is difficult to have an objective opinion and that’s why I’m reviewing the ones that I have more experience with! More specifically…. Codeigniter… Laravel Phalcon… Symphony… Zend framework… Slim and finally the ones that are using only composer packages!

First of all before starting comparing the frameworks that I’ve used the most, I know that there are plenty other PHP frameworks but the list is huge and it is impossible to compare all of them! That’s why I believe that if we compared just the frameworks that I have experience with, it will also help you decide which framework fits better for your needs! I’m getting lot of questions to say my opinion about which one is the best but there is not a straightforward answer on that question as it is not something objective! I will give you an example… if the questions were a bit more specific then maybe I could reply with the more specific answer.

For example which is the most famous PHP framework?

The answer is Laravel!

Which is the most fast to learn?

The answer is CodeIgniter!

Which is the best for performance?

Easy answer as well Phalcon!

Which is the most extendable?

The answer is Symfony framework!

The Codeigniter framework

The main thing that is difficult for me to explain to other developers is that different frameworks will solve different problems so for example questions like “Okay Johnny I get it but let’s say that you have to choose only one framework for your project at work! Which one this should be? For me this type of questions are very difficult to answer So the answer is always… “it depends” and that’s the main reason that I did create this video as a video answer to many people that have the same question out there! I will go through the frameworks alphabetically so I will not have to choose which one is the number one have in mind that the review is coming mainly from my experience with them with the ten years working on PHP and PHP frameworks! Everything that I’m about to say is my personal opinion so if you disagree with something that’s fine! Just make sure that you live a gentle comment at the description below. With that said we can finally start! So let’s start with one of my favorite frameworks out there that also come first alphabetically, this is… Codeigniter.

Chances are that you’ve already heard Codeigniter before as it is one of the simplest PHP frameworks out there that you can use! That’s true because the documentation is just huge and as it’s been a while that this framework wasn’t bitten refactored you can find many questions answered on Stack Overflow you can literally find anything you have problem with Codeigniter with just googling it!

I’m suggesting CodeIgniter mainly for beginners to simply see the power of using libraries that are easy to use. Although powerful you have to be a little bit more careful as it is very easy to create too many lines of code for something that could be handled differently.

Last but not least CodeIgniter has really fast rendering and performance as it has smaller footprint when the libraries are called in comparison with other frameworks! So as a summary use Codeigniter… if you are a beginner and you really need to learn a framework very fast. If you don’t want to install composer in your local machine to start coding! For example I’ve noticed that many Windows users hate the console!! If you want a fast website without spending too much time investigating on the performance. And lastly if you have a small to medium-sized business and you really need to have a fast start of your project. You can literally start delivering value the fastest possible and actually have a full complete functionality in CodeIgniter.

Just have in mind that it will be more difficult to extend the framework at the future if the development team is getting bigger and bigger. Personally I love CodeIgniter because it is a stable and a fast framework and I’m suggesting it all the times. However I am really struggling most of the times if I would like to change a default behavior of the framework.

The Laravel PHP framework.

Next framework is Laravel or else the framework that you will either love either hate! Usually people are loving it because the code is clean and it follows good practices! It is also the most famous framework out there and hence you can find plenty libraries that you can use and it is also a preferable framework from companies.

On the other hand people hate it because it is more difficult to learn and because they believe it is slow! The slow part is kind of true to be honest but have in mind that if you use PHP 7 and start using good practices in Laravel such as caching with OP cache and caching the slow responses, you will see big improvements on the performance of Laravel. Also if you would like a lighter version of Laravel I would also definitely suggest the mini framework of Laravel with named Lumen!

I don’t want to extend my opinion for Laravel, as you can find plenty of articles talking about it. As a summary in my opinion use Laravel if your business can afford the learning curve of Laravel! If you would like clean code and you care about what is on the background that’s running! If you would like to see how it is to use the latest technologies and best practices on programming. If you are a big team and the project is getting bigger and bigger.

Have in mind that Laravel will also help bigger teams as there are plenty of very good tutorials to learn it. And lastly use Laravel if you know that you can configure the server with the best possible way in order to use latest PHP versions and caching. If you are using a simple cheap hosting I wouldn’t suggest it as you will probably struggle with the performance of Laravel.

The Phalcon framework.

Next framework on our list is Phalcon or else one of the fastest framework out there! The framework is built with C and that’s the main reason that it’s super super fast! People that will see some benchmarks can’t skip the fact that it’s really a fast framework! On the other hand I personally find it really difficult to use it as the documentation is not as easy in comparison with other frameworks. I’m not sure if it is the documentation that is not good or the syntax to use it but I couldn’t get used to it to write to Phalcon.

The main problem that you may experience is that if you are creating a product for lot of customers – for example let’s say that you are a Web Agency – you will need to make sure that your customer’s server is configurable to install PHP extensions like Phalcon. And lastly I couldn’t find too many extensions of Phalcon! I guess it doesn’t fit very well for a PHP developer to write extension in C? Who knows? Now don’t get me wrong!

Phalcon is a fantastic framework and it does the work very very well and very fast! And it is a very stable framework as well. From the people that use it for a while it seems that they never had big issues with the framework. It is just that in my personal taste I never liked it so much and I was struggling to configure it. If the performance of your server is the number one priority for you then I think Phalcon is the best solution that you can get as an MVC PHP framework!

The Slim framework

Now let’s go to Slim! If you are an experienced Web Developer in PHP you will probably heard about Slim framework, although it is very possible that you’ve never probably worked in a company asking you to know Slim or using them extensively! To be honest Slim is not so famous as a framework as in my personal opinion is a too abstract framework!

On the other hand is a very good framework to use if you want to start fast and you have plans that you will have a unique architecture of your project! So I would suggest Slim mainly to be used by more experienced developers as it is giving you the complete freedom to use it with your way! That simply means that if you don’t know what you are doing you will probably end up with too much lines of code.

Slim is a very good and light framework but I wouldn’t suggest it for Junior developers! I would suggest Slim for experienced PHP developers that will like a more simple and a light framework at the same time… or to create a very fast demo project at the beginning!

The Symfony framework.

Next one in our list is Symfony framework! I have to be honest here that’s the only framework that I don’t have a full opinion as I’ve never used it as a primary framework.

On the other hand I am always using their awesome composer libraries! I’m using Symfony libraries for a while now and the main feedback that I have for Symfony is that they are doing a really great work when they are creating libraries! Really the best libraries and with very good documentation! However to use Symfony as your primary framework is not that simple as it is a huge framework in my opinion. If you would like a simple framework to start is their mini framework with name Silex. Some friends of mine are using Silex and they are very impressed about the power of the mini framework.

As I don’t have a full opinion about Symphony don’t forget to leave some comments below if you have some good or bad experience about Symfony!

The Zend framework.

Next one in our list is Zend Framework! Always when I’m referring to Zend Framework as one of my favourite frameworks people go like…. whaaaat? Seriously man this is the most complicated framework I’ve ever used! I prefer to write my code in Java!

So many lines of code for one simple thing …. and so on… well people are… right! It is complicated, there is no good documentation and Zend framework is a huge monster! However the libraries are unique and fully extendable and that’s why I’m using it! In fact Grocery CRUD Enterprise using it primarily for the database connections and so far it’s been a great choice! The only flaw really is the documentation that I think is really really poor! I was using Zend Framework V1 extensively and I am using Zend Framework 2 and I’m very impressed about the stability that their libraries have!

I would suggest Zend Framework only to very experienced developers… and just because you asked it YES it is very close like writing Java! And finally we have the way to not use any PHP framework and just use composer packages! For this I have to say only one thing! You have to be really careful as your project may become huge. I will explain you what I mean! Usually people are starting with a white canvas of no code at all and start adding composer libraries on the go.

This is theoretically very good as an idea as you can use any library you love. On the other hand it is very possible that the best composer libraries usually are coming from the development of frameworks. So in the long run you may end up with 4 frameworks into your project without a really good reason.

This is making it more difficult to extend it with new developers at the team so you have to be careful if you are going to follow this path! In my opinion it is better to choose a framework that you love and use any external libraries from composer if it’s necessary. With this way at least you will have a consistency on how you and your team will write code.

Also you are making sure that your code is not too heavy with the extra libraries that you call. As a summary use whatever framework fits to YOU and don’t listen the trends if you are happy with the framework that you are using. For me the important rule to follow is that don’t stay to… “it works” but also have the extendability of the project in mind. Usually most of the projects are starting small and they are getting bigger and bigger so you have to be careful that you know what you are doing when you are choosing a framework.