Once upon a time, when creating a new application web developers didn’t have to think much about how to begin. They either started writing code from scratch or didn’t start at all. This was true no matter the programing language.
Today, sometimes there is a need to write your own code from zero, but in most cases relying on a framework can save a lot of time and effort, and produce a more stable product. Usually, this means using finished code that is structured properly and avoiding writing repetitive code, while focusing on the application itself.
And when talking about PHP development, using a PHP framework is the way to go nowadays. But with several tens, hundreds (maybe thousands?!) of them available, choosing the right one might be a problem.
With this blog post, we will not solve this, but you will see which ones we like to use and this might help you with your choices.
Symfony - the king of complexity
One of our go-to frameworks is Symfony. It is more than 10 years old and has a faithful following, which makes it one of the most stable frameworks out there. Years of development and long support periods (3 years for LTS releases), make it perfect for large-scale, complex projects which fit well with different business-related demands.
What we like about Symfony is the ability to create scalable web applications, and that it enables us to easily adapt to the changing needs of our clients, without having to discard everything we have already done. This is mostly due to Symfony’s bundles and components feature, which enables us to reuse code our developers write or to use some proven components that fit perfectly with this framework.
Another great thing about Symfony is testing. We, naturally, test every app we create to make sure it works properly, and this framework integrates perfectly with PHPUnit and PHPSpec libraries for unit testing and test-driven development, so we can be sure this phase of each project is carried out thoroughly and in a timely manner.
You may hear that Symfony-based apps tend to run slow, but if you make sure to carefully select components and develop new features, you shouldn’t have an issue with that. Also, make sure to upgrade to the latest stable PHP version and use caching systems such as Redis, APC, Memcached or other.
Laravel - the ruler of the front-end
The popularity of this framework is probably another reason to choose Symfony. Confused? No need to be. Laravel today uses several Symfony components, making it a great tribute to the older “cousin”.
At the same time, this framework has at least one benefit over Symfony - it is significantly easier for beginners to use it. Not really an issue for us at TMS, but if you are new to this - it is an important point to consider.
Using a stable “backbone” makes Laravel a great way to start building your web app and make sure it is secure and works well. This framework also has a simple way of expanding application features through Bundles and Composer. Worth a mention is that testing features are embedded into Laravel, to make sure final product is ready.
In our experience, Laravel has proven to work best as a front-end framework for complex back-end systems we develop using other tools. Integration between the two is easily done via API’s that we create for our projects.
Slim - only what you need
One of two micro-frameworks we regularly use is Slim. Since frameworks like Symfony and Laravel are well suited for larger and more complex projects, they are bloated to be used for simpler apps. This is why we rely on Slim and Silex.
With Slim, you can’t go wrong. It is fast and has all the features a micro-framework should have, while not adding anything you might not use and might slow down the final product.
Of course, you can extend it easily if you need to do so. As for us, we usually rely on it to create RESTful APIs to be used with applications we developed.
Silex - two in one
In the end, there is already mentioned Silex. It is based on Symfony and comes in two flavors - fat & slim.
Originally created as a simple micro-framework to be used similarly to Slim for smaller, specialized apps or APIs, but over time it evolved and its fat version is now a full-stack framework.
We love it because it is based on Symfony and works well with applications developed in it. And also because we can expand it easily if we need to. But usually, we plan our projects so well we know how we will use each of the frameworks and do not need to do anything we didn’t expect.
The choice is yours
If you are researching PHP frameworks, you will surely hear of some other examples, like Zend, Yii, CodeIgniter, CakePHP… If you are a developer - when you find the one that fits you - go for it. We can only talk about the ones that have proven to work for the projects we developed.
If you are a business looking to develop a new application - try not to choose before talking to an experienced web application developers. When we put our consultant’s hat on - we look at your needs and recommend the technology stack that would be most useful.
But we are not running away from other frameworks. if you are already using another one and are looking for someone to take over your application development - we are more than happy to take you up on the challenge!