PHP is the most popular language for server side development and as a result, has a large number of open source frameworks. This can be a blessing or a curse depending on which way you look at it. Although choice does give you more options, the large number of frameworks means that there is a lot of competition and it is common for perfectly good frameworks to go in and out of fashion as newer, trendier frameworks are released.
The frameworks can be split into three types based on what they will be used for: Bespoke Applications, Content Management Systems and E-commerce. In this article we will focus on frameworks intended for Bespoke Applications and these can be further split into micro-frameworks and full frameworks.
Full frameworks for Bespoke Applications
As I mentioned earlier, PHP frameworks go in and out of fashion and this is most apparent with full PHP frameworks. Some frameworks which have lost some popularity over the last couple of years include CakePHP, Codeigniter and Symfony. Laravel is fast becoming the most popular of the full frameworks but as you can see from the graph, its rise in popularity has happened rapidly in the last few years.
Micro-frameworks for Bespoke Applications
Micro-frameworks are scaled down versions of the full frameworks and suited for projects which require only the core set of features. This can either be because the project doesn’t require as many features, or it could be that the developer prefers to build some of the other features such as authentication. For this reason, micro-frameworks are actually significantly smaller in size than the full frameworks. For example Laravel is a shocking 16.5MB whereas Slim, probably the most popular micro-framework, is only 0.5MB.
Adopting an MVC architecture
Most modern frameworks use a Model View Controller (MVC) architecture in which controllers handle requests form the website and the presentation layer (ie HTML) is split up from the data layer (ie database queries) using views and models respectively. Most modern PHP frameworks use an MVC architecture since it provides an excellent way to structure your application.
What should I look for when evaluating a PHP framework
There are several factors that I look at when evaluating a new PHP framework which are all geared at how easy the framework is to use and whether it reduces development time.
This is the first port of call when trying to figure out how to use a framework. The documentation should be easy to follow and ideally have a quick reference. One of the main reasons why Codeigniter remains one of the most popular frameworks even when there are better alternatives, is probably down to their documentation which is very easy to read.
2. Developer Community
An active developer community has two distinct advantages; firstly that you can obtain assistance with problems you face when using the framework (ie via forums) and secondly to find out about extensions or plugins built to work with the framework.
3. Language Syntax
4. Prebuilt Features
Micro-frameworks generally have fewer features than full frameworks. Many of the features of full frameworks such as database access are implemented in micro-frameworks but just scaled down, so you have less ‘out of the box’ features already built for you. In some cases frameworks have a better implementation of a particular feature such as User Authentication, so you should look carefully to see which features are relevant to your project.
Although there are many PHP frameworks available, the choice that you make should be based on the requirements for each individual project. In practice however, most developers have a favourite framework and stick with this for most projects.