Codementor Events

Guide to 24 PHP Frameworks

Published Sep 04, 2018
Guide to 24 PHP Frameworks

This guide provides comprehensive explanations about 24 of the most popular frameworks available
Click here to see the content in the original website

PREFACE
Image 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 learn how to use PHP Frameworks!

Below I have listed a review of 24 of the best PHP frameworks that will give you enough knowledge on how to 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 do its effect.

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

INTRODUCTION

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”.
photo frame.jpg

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 on. This is a software that provides basic functionality through which 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 meets your problem before you.

This means that there is the possibility of a likely solution out there on the web.

That is why Stackoverflow has more than a million users, with another million of questions tagged as PHP.

Why use frameworks?

To answer this question, I need to go a little bit deeper on what frameworks do.
Every project you do usually begin with the same process.

If you are like me, you have your checklist on the side of your laptop and a pencil ready to fire at any action you do to start the development process.

If you do not have something like this, it is very likely to miss something important that would require been included afterward.

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

Why worrying about setting up authorizations, sessions, writing codes that protect 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 time is money.

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

Frameworks 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 been processed.

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

It permits redirections and a better SEO management creating SEO-friendly URL.
php-framework-comparison (1).jpg

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 stuffs.

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.

Here is a video that lists the top 10 best framework according to Traversy Media

It worth to have a look at it

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 performances of frameworks are slower than code which you can write by yourself.

That is because they have lots of features that need to please the majority 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 my beginning, as soon as I was able to write HTML fluently, I started learning JavaScript.

Less than 2 weeks, I already abandoned it and spent most of my time writing in jQuery. jQuery is a library that allows 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, VueJs 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 basis as long as you need. PHP frameworks often use principles, design patterns, unit test, 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 for others there is 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 pick up 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!

You can find more frameworks' reviews in the second part of this article

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

Agavi is a PHP framework that gave 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 towards 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 Commands like.

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

I have 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 use frameworks or write big PHP applications, but instead makes sure his customers can do exactly that!.

Official Website
GitHub Repository

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

It started out in April 2005, by the finger of Michal Tatarynowicz, a Polish developer who first published the project under the MIT license and baptized it 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 in the top 5 as usage. It retraces in several ways the characteristics seen in Ruby on Rails and also uses several design patterns, MVC principle, active record and the paradigm of Convention over configuration.

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

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

This means that Cake PHP can easily create a complete C.R.U.D. 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 forum, and official and unofficial docs.

In recent times, the people in CakePHP are working as hard as ever, releasing the last version 3.5 for the record officially called Red Velvet.

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

So if you are in the US or you would like to discover more about this framework and take a nice trip, what's the better occasion?

Official Website
GitHub Repository

rsz_book-cover.jpg
To be continued...

This blog post is a section of the Kindle book "The Definitive Guide to your next PHP framework"

You can find more frameworks' reviews in the second part of this article

Now It's Your Turn

I hope you enjoyed my frameworks' comparison.

Now I want to hear from you:
Which was your first PHP framework?
Are you going to try one of these listed above?

Let me know by leaving a quick comment.

Discover and read more posts from anastasionico
get started