The Definitive Guide to Your Next PHP Framework (Part 1)

DZone 's Guide to

The Definitive Guide to Your Next PHP Framework (Part 1)

In Part 1 of this three-part series, a developer explores the concept of frameworks in a web app, why developers use frameworks, and a few interesting PHP frameworks.

· Web Dev Zone ·
Free Resource

Image title

Imagine if you could type one simple command on your terminal, and see half of the code required for your new web application already written.

This is the power of using PHP Frameworks! 

In this series, I'll review 24 of the best PHP frameworks that will make your job easier and faster.

Let's get started! 

Writing code is fascinating. Writing readable code is even more fascinating. When can you do both? That's when you can program for hours and still feel fresh like when the first coffee of the day starts to kick in.

And I have something that will make you feel that way.


What is a framework?

Let's start at the beginning, what is a framework?

By breaking up the word “Framework” we get “frame” and “work”.

 A frame. Think about the frame of a house, a structure in which everything else is built around and any work done will depend on its shape. I can say the same for a photo frame, it defines the structure and any photo inserted has to be the size of the frame.

A framework is simply a predefined skeleton in which you do your work. This is software that provides the basic functionality that can be extended using your code. The advantages of using these functionalities are that they are standardized and reusable.

Pretend you have spent the last half-hour trying to find a solution to your problem. By using a standardized service, it is very likely that someone has already run into this issue. 

This means that the solution is probably out there on the web.

Why Use Frameworks?

To answer this question, I need to go a little bit deeper on what frameworks do. 

Every project you work on usually begins with the same process.

If you are like me, you have your checklist on the side of your laptop and a pencil ready to check off each action item you complete that helps to start the development process. 

If you do not have something like this, it is very likely you'll miss something important.

Frameworks allow you to free your mind from these tasks and focus on the development process rather than the preparatory stage.

Why worry about setting up authorizations, sessions, writing code that protects you against cross-site request forgery attacks, and so on, when you can spend more time just doing what you love?

Not to mention the time you will save by finding this code ready for use, and as we all know that time is money.

Since the first framework came out, the list of features being implemented have increased to a much greater degree.

Framework creators now have years and years of experience on their background.

This has made them make improvements on it and use the more up-to-date standards on security, as I have shown above.  

And not only that, lots of PHP framework can be installed via Composer. In some other cases, you can even just download the directory from a git repository and it is ready for use.

Put in place Composer to require third-party packages and resources as a great method to extend your projects and make them more scalable.

The code that the majority of them uses is the PHP Object Oriented principle. 

They automatically create classes and objects in the background (you will never need to worry about including files again). 

They also follow the MVC pattern, by dividing the code into Models Views and Controllers, PHP frameworks make the code easier to work on and increases the scalability of the project. 

Another feature common among the majority of PHP frameworks is the way requests are processed. 

The routing system of some of them, in fact, is a piece of art. 

It permits redirections and better SEO management, creating an SEO-friendly URL.

When Should You Use PHP Frameworks?

To answer this, you need to ask yourself some questions about the project you want to build.

  • What are its needs?

  • Does the framework of your choice cover those needs?

  • Do you have enough skills on the framework to accomplish what you need to do?

When using a framework, you need to realize that this skeleton can weigh quite a bit even though you are yet to get started. 

So if you are just building a to-do list to get from your phone next time you go to the grocery store or a simple portfolio page that list your skills on a digital screen, you may not need all this built-in stuff.

They will be a problem and decrease the performance rather than a solution.

A PHP framework can be useful in many cases but it is not always necessary. If creating your applications will be easy and there are not too many features, then the right choice could be to just do it yourself.

When Shouldn't You Use it?

Using a PHP framework is not always peaches and dandelions. 

There are several downsides that you as a web developer need to understand.

A framework is an external component. It is coded from somebody or a team with its own mindset and objectives.

Sometimes, those objectives do not go in the direction you need for your projects.

Rasmus Lerdorf, the creator of PHP has spoken several times against them, pointing out all the problems arising from their use.

As said previously, the performance of frameworks is slower than code which you can write by yourself. 

That is because they have lots of features that need to please the largest number of developers possible.

This means that frameworks solve different problems by providing a general solution.

You may need to put in just a couple of PHP functions, instead, you will find yourself with a lot of implementation that you will never use and this slows down the execution of your project.

Who Should Use Frameworks?

We have talked about the “when,” now it is time to explain the “who.”

To do that, I will tell a bit about my story. 

In the beginning of my coding journey, as soon as I was able to write HTML fluently, I started learning JavaScript.

In less than 2 weeks I had already abandoned it and spent most of my time writing in jQuery. jQuery is a library that allows you to code in JavaScript using a much simpler syntax.

It was simpler, it was quicker, and there were lots of tutorials and plugins available.

After a little while, I needed to take a step back and bought a book on JavaScript as there were several JavaScript frameworks starting to get released.

There was Angular, Vue.js, and React and lots of new things coming out every day that do not use jQuery but vanilla JS.

The lesson I have learned is to stick with the basics as long as you need. PHP frameworks often use principles, design patterns, unit tests, containers, migrations, and lots more that a newbie does not understand.

You do not have to be an expert but you must be an experienced PHP developer. 

When you feel you are ready you need to book some time to learn any framework of your choice. 

Some of them are really easy, while others have a very steep learning curve.

Do not give up! It won't make any sense for the first couple of hours, this is normal.

Just complete the tutorials, search for an explanation online and everything will beging clicking soon.

Now that you understand the basic concepts of using a framework, you are ready to go deep and examine each of them.

It is important that you do read the following chapter after analyzing what problem your application or the website you are going to build needs to solve.

Enough with the preface, let’s get started!


Agavi was mainly developed by David Zulke, but has 20 other contributors on over 60 releases. 

Agavi is a PHP framework that was at its best between 2006 and 2009. 

It is a fast and lean product that is meant to work on a PHP 5 environment. 

The chief focus is toward a few features giving freedom to you as the developer to shape the project as you prefer.

It can be installed via Composer or by downloading the repository from GitHub. 

This framework can be used for almost every project but it is advised to use it on long-term projects, with a large codebase. 

It is accessible via HTTP protocol, SOAP, and the commands line. 

If you want to adjust an old project, or you just want to try this framework out, Agavi still provides a good amount of information and tutorials on its website as well as API docs, FAQs, and blog posts.

I interviewed David while writing and he was still really passionate about this framework. 

He claimed that Agavi still has its users, even though he thinks most of them have modified it heavily over time, or taken some of its core concepts, which have aged pretty well overall, and ported them to some custom solution, e.g. Symfony, underneath. 

He now maintains the PHP language support at Heroku, so he no longer really uses frameworks or writes big PHP applications, but instead makes sure his customers can do exactly that! 

Official Website

GitHub Repository 


CakePHP is maybe one of the most important PHP frameworks out there.

It started out in April 2005, created by Michal Tatarynowicz, a Polish developer who first published the project under the MIT license and baptized it as Cake. 

CakePHP was taken over at the end of the same year by some other programmer that eventually created the Cake Software Foundation and released version 1.0 in May 2006. 

In 2018, after all these years, it is still considered one of the best and is on the  top 5 most used PHP frameworks. It retraces in several ways the characteristics seen in Ruby on Rails and also uses several design patterns, such as MVC principles, active records, and the paradigm of Convention over configuration.

I'd like to linger on this paradigm and explain its power. 

After you, as the developer, have learned the few convention rules like call a class in a certain way or to end the name of a foreign field of a table with “_id”, the backend of the framework creates everything by itself. 

This means that Cake can easily create a complete CRUD system and relationship in just a few seconds by using the name provided within the database.

I believe that if you want to level up your skills and try an easy framework, this is what you need to start with. 

It has several features that can be insidious in the beginning, but, after all, it is quite an easy learning curve. 

There is a lot of support from the community, over 7000 stars and 3000+ forks on GitHub, plus forums, and official and unofficial docs.

Recently, the people at CakePHP have been working as hard as ever, releasing the last version (3.5), officially called Red Velvet. 

This year they are also arranging a conference in Nashville, TN. 

Official Website

GitHub Repository 
To be continued... 

This blog post is part 1 of 3 of the Kindle book "The Definitive Guide to your next PHP framework."

The following parts will be published during the next couple of weeks  or click the link below to download the full version

cakephp, php 7, php frameworks, web dev

Published at DZone with permission of Nico Anastasio . See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}