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

16