DEV Community

Anders Björkland
Anders Björkland

Posted on

Have Yourself a Model View Controller

Just the Gist

MVC is a popular design pattern that many PHP frameworks supports. Some of the most popular open-source MVC frameworks in the PHP world are Laravel, Symfony, and Yii.

A quick overview

A popular design pattern used in web development is the Model View Controller (MVC) pattern. MVC had its first implementation in a language called Smalltalk in the late 70's. The aim was to put the user of a computer system in control of large and complex data sets. The short of the pattern is:

  • Model - representation of knowledge.
  • View - a visual representation of the model.
  • Controller - handling the user input and the model changes.

Many of us Web developers have been using MVC for years. And it has worked pretty well in most cases. Today we are listing some of the most popular frameworks in PHP that support MVC.

Some MVC frameworks to look for

This is not an exhaustive list of MVC frameworks, and we will return at a later time to look at some micro-frameworks. With that in mind, here's my list of the most popular MVC frameworks:

These are far from all of the available open-source PHP MVC frameworks. Here they are arranged in order of number of stars on GitHub - not the best metric of popularity. So let us hear what you are using and what you like.

A personal take

I've come to really like Symfony. It may be because I was introduced to programming through Java and was first exposed to MVC frameworks with Spring Boot. That Symfony came packing with a dependency injection container felt just natural at the time. I've been using Symfony for most of my projects and I'm very happy with it. With this in mind, I have not ventured far beyond these pastures. I've dabbled with Laravel and was confused by its model-implementation. But I've also dabbled with Silverstripe and now the model-implementation is not as foreign to me any more. The reason that it felt foreign was that Symfony rather divided up a model into entity and repository.

What about you?

Please share your experience with the MVC frameworks you have been using. Are the popular frameworks suitable for what you are doing? Do they feel bloated or are they just about the right size? Which is your favorite framework? Maybe frameworks are not needed for your projects? Comment below and let us know what you think ✍

Further Reading

Latest comments (4)

Collapse
 
fchaussin profile image
François CHAUSSIN • Edited

I've started PHP in 2002 with php4 without any framework, later in the 2000' i started using Codeigniter, but now I prefere using Symfony

Collapse
 
andersbjorkland profile image
Anders Björkland

You've been through the evolution all the way!

Was there any particular reason why you prefer Symfony?

Collapse
 
fchaussin profile image
François CHAUSSIN

CLI PSR and ecosystem

Thread Thread
 
andersbjorkland profile image
Anders Björkland

There are some good tools. I like the maker-bundle!