Home > Backend Development > PHP Tutorial > The State of PHP MVC Frameworks in 2017

The State of PHP MVC Frameworks in 2017

Lisa Kudrow
Release: 2025-02-10 15:32:11
Original
976 people have browsed it

The State of PHP MVC Frameworks in 2017

Key Points

  • Laravel and Symfony are currently leading PHP MVC frameworks with a strong community and new capabilities for ongoing development.
  • The rise of microservices and container-based architectures is changing the role of MVC to building applications as "functions".
  • While Laravel is in the lead, large Eloquent models and excessive services can complicate them, resulting in monolithic applications.
  • Symfony Although sometimes it leads to monolithic applications, it provides elegance and flexibility by using repositories.
  • The advent of microservices does not mean that PHP is dying, but developers should stay ahead and consider learning GoLang or Node.js.

This article was originally published on ZenOfCoding and is republished here with permission from the author.


The State of PHP MVC Frameworks in 2017 A simple question prompted me to sit down and write this follow-up to my post about a year ago.

Q: What do you think about the current situation? (February 24, 2017)

A: "I think it's mainly up to Laravel and Symfony right now; as far as the PHP framework is concerned. If you're starting a new project, I don't think there is any special value to use CakePHP, Zend, CodeIgniter, Yii, etc. I can see reasons to use these frameworks only if you already know about them or have developers who have a habit of using them. When real development begins, you must be able to find answers to tools, plugins, and frequently asked questions. With the Laravel and Symfony communities and the ongoing development of new “modules” or features, you never feel backward. Laracasts alone (even if you don't develop with Laravel) is great.

Whether it is integration with services such as iron.io or other SaaS providers, support for various data sources, or local development environments like Homestead, these frameworks and support modules are more forward-looking.

Lumen complements fast API development, and Laravel is indeed an excellent method for fast application development and prototyping today. This is not to say it is subject to some sort of limitation when building large applications.

However, overall, we do see a shift to a container-based architecture where MVC is much less effective. It's all about microservices, orchestration, and building applications into "functions" (i.e. AWS Lambda and similar services). Maybe it's time to improve your Node.js and GoLang skills :)”

While I'm generally satisfied with this answer, I can't help but think it's a good idea to elaborate on some of these points and re-examine the status quo.

Before I start talking about strange topics like "GoLang", let's take a step back and see the trends in the 2017 PHP MVC framework field.

The State of PHP MVC Frameworks in 2017

I think the trend we have observed in the past is continuing. Laravel is still evolving while others are behind. Symfony’s popularity has risen slightly, possibly due to the highly anticipated release of Symfony 3.

(I tried more specific comparison searches like "CakePHP 3" or "ZF2" but these searches did not produce statistically significant trends).

I joined CodeIgniter this year because it was very popular, and that was obvious. I've received many questions about CodeIgniter and my opinion on its place in the PHP MVC community... In short, CI still doesn’t compete because it’s not a real MVC framework. I don't know how to call it except for a well-organized POPO collection...

Let's quote directly from their manual:

CodeIgniter takes a rather loose approach to MVC because no model is needed. If you don't need extra separation, or find that maintaining models is more complex than you want, you can ignore them and build your application in a minimal way using controllers and views.

I totally disagree with this approach when it comes to building the framework. Maybe it's a nice boilerplate, which is why CodeIgniter is popular, but the framework has to enforce certain disciplines or the end product will become a bunch of spaghetti codes wrapped in some kind of "patterned".

Next, Symfony 3 brings us some improvements to the developer experience, dependency injection, and many other features. Like many PHP counterparts, it now provides a microframework. By contrast, ZF3 offers a range of improvements, such as support for PHP7 (eventually) and even its own microframework…but as their manual says:

For Zend Framework 2 MVC users, the difference is subtle...

I really hope they say there are a lot of differences, there are some major architectural improvements, and some wonderful new modules that help you develop things in a modern way. Alas, in most cases, ZF3 is still very similar to ZF2.

Long story short

This is how I look at the world of PHP frameworks today:

  1. Symfony or Laravel, depending on your needs
  2. Others

There is no doubt that Laravel steals the show. The amount of information available, Laracasts, global developer talent, simple schema implementation, integrated test toolset, activity record implementation in Eloquent form, lightweight versions in Lumen, local development using Homestead (Vagrant) makes this framework for It stands out for both newbies and experienced developers.

But the Eloquent model can become cluttered and quite large, potentially creating too many Laravel services (not to be confused with microservices), and people are beginning to consider implementing the repository pattern where it is not suitable. Therefore, monomer applications were born.

If you are not familiar with the active record mode and need the extra flexibility of the repository, or you don't like seeing too many anonymous functions, then use Symfony Doctrine. Do I think Symfony is the path to monolithic applications? To some extent, yes. However, it is probably the most elegant one.

Overall, I won't call it a drastic change compared to last year. Still, we need to look at the problem from a larger perspective: a well-designed application is not just MVC; it also involves infrastructure, deployment pipelines, decoupling architectures. All of this can be implemented in the MVC stack, but extra care is required to avoid monolithic applications.

The emergence of microservices

I mentioned the rise of microservices and the need to improve GoLang or Node skills. In fact, even in the PHP MVC article, it would be foolish to not mention the obvious shift to microservices-oriented architecture (MOA); and it is incredibly fast.

While these two concepts are not mutually exclusive, there is no reason to try to find similarities between the two, as they do represent different, albeit intersecting philosophy.

For example, putting your MVC application in one container, putting MySQL in another container, and then linking them together does not necessarily represent a suitable MOA. This is certainly a better approach, in fact, much better than trying to install MAMP, XAMPP, or whatever other messy thing you need to get a local machine to serve your application.

In addition, it can solve some problems such as easily running local environments on different platforms (developers), and deploying policies in some cases, but MVC monolithic applications still exist in your application layer/container .

Destruction of monomer applications

This kind of "destruction" is exactly what microservices want to achieve. While MVC solves your code structure and organizational issues by providing a reliable way to separate concerns, container/service/MOA extends this concept even further.

You no longer just separate the view from the model, but now separate each "block" or logical unit of the application into a separate service designed to properly handle its own responsibilities.

If your MVC application has a "search" controller, operations, and related model methods, then we already have examples of monolithic applications.

Instead, using the MOA method, we will provide one service for each processing unit. For example:

  • Routing Service
  • Request Service
  • Inquiry Service
  • Data source service
  • Response Service

Wait, but aren't all these "services" part of the MVC stack? Yes, that's it. They are building blocks for our monolithic applications.

With MOA, each service runs in its own environment, and as a developer and more importantly, as an architect, we are free to design the best way to solve a specific need.

For example, if I were to write an image processing service in a Laravel environment, I might use tools like PHP-GD2 extensions, which may not be the most efficient way to process images. The C service that handles my image processing needs may be much faster and is certainly more powerful on scale. To elaborate further, we can now take the output of the image processing service and send it to the DataStore service, the CloudStorage service, and the Queue Email service.

Using a bunch of cron jobs and possibly some separate MVC applications and custom scripts to solve the same challenge, that's what we did in the past (i.e. 2 years ago). It's time to move forward.

Scalability

This is where the problem begins (or ends, depending on where you are heading). On the one hand, it is difficult to scale monolithic applications, and if you build more and more logic in the same MVC stack, you may come across a well-structured application, but its complexity is terrifying.

On the other hand, if you build thousands of microservices in different languages, how do you manage that mess?

More than one disaster has been reported.

There are various container orchestration tools (such as Kubernetes, Swarm, Mesos), container deployment services (i.e. GKE and AWS ECS), but few enterprises have mastered the Docker architecture. There are indeed some success stories about building infrastructure using Docker or other container technologies (i.e. GKE). Most of these cases come from companies that can undertake the resources of architects, DevOps, DBAs and engineers. Nevertheless, for now, there are countless debates about how to deploy a well-arranged and elegant MOA. In this case, one size is absolutely not suitable for all situations, and there are many ways to solve your challenge.

Either way, you can't solve this problem alone (DevOps FTW!), and it only needs to be solved after reaching a relatively large scale. Maybe now isn't the best time to over-design.

For today (and those who deal with applications with low complexity or traffic demand), a happy intermediate approach is to offload many typical services to third-party providers. Almost everything is now available as a service. Background jobs, image processing, authentication, data analysis, logging, email sending, queueing systems do not need to be built in the same MVC stack, and architects should consider what can be offloaded to the SaaS system for a low monthly fee (i.e., Algolia Search) or a custom built docker service that may run in some cloud spaces that handle annoying image processing.

The point here I think is that you shouldn't dive head-on into a re-architect project, don't throw away everything you have today, and release docker swarms wherever you can imagine. The basis for improvement can be gradually introduced by decoupling possible parts, understanding bottlenecks in the system, and applying the concept of separation of concerns to these problem areas.

Conclusion

2017 will bring us more conversations and production deployments about container-based MOA. My views and nonsense about Docker, using GoLang or Node doesn't mean PHP is "dead" or anything like that...I feel like we need to stay ahead of the pack as developers, so if microservices are where it is Where, then why not learn GoLang? It is ideal for developing small containerized applications (due to the small footprint, fast speed and parallel processing). Node and GoLang are fun because they allow you to build small services that are part of large tribes that link them together and publish them as epic swarms for Docker containers if you prefer. However, all these awesome cutting-edge solutions and languages ​​do not mean that PHP is therefore no longer relevant or “dead.” We will certainly build the MVC stack and API endpoints over a while.

One problem that has not been solved with MOA is that while containers help us eliminate monolithic applications on the backend, we still face many architectural issues in the front-end layer, UI, or views. We can build a very powerful backend application, but eventually it will respond in JSON, which must be rendered in the client application somehow. Does the final response object come from a simple PHP (for example, a Lumen-driven endpoint (URL)) or a series of decision and processing units decoupled by a message interface? It really depends very much on your needs and the requirements of your application.

This year, learn about Laravel, focus on Docker, GoLang, and absolutely focus on deploying pipelines. The conversion from local to production should be smoother than it has been for a while, especially when building MVC applications.

FAQs about PHP MVC frameworks

What is the MVC framework in PHP?

The Model-View-Controller (MVC) framework in PHP is a design pattern that divides an application into three interrelated components. The model component corresponds to the user using logic related to all data. The view component is used for all UI logic of the application. On the other hand, the controller acts as an interface between the model and the view components to handle all business logic and incoming requests.

Why should I use the MVC framework for PHP development?

PHP development using the MVC framework has many advantages. It provides clear separation of concerns, which makes the code easier to maintain and understand. It also promotes reusability and scalability of the code, allowing developers to create robust and large-scale applications. Additionally, MVC frameworks often come with built-in tools and libraries to facilitate tasks such as database abstraction, form validation, sessions, and cookie processing.

What is the top PHP MVC framework in 2017?

In 2017, some of the top PHP MVC frameworks include Laravel, Symfony, CodeIgniter, Yii2 and CakePHP. Laravel is especially popular for its elegant syntax, powerful features and a vibrant developer community. Symfony is also widely used for its high degree of flexibility and modular architecture.

How to choose the right PHP MVC framework for my project?

Selecting the right PHP MVC framework depends on several factors, including the size and complexity of the project, the team’s expertise, the framework’s community and support, its performance and scalability, and the learning curve involved. It is recommended that different frameworks be studied and compared based on these factors before making a decision.

How does MVC mode work in PHP framework?

In the PHP MVC framework, when a user sends a request, it first goes to the controller, which identifies the appropriate model to process the data. The model then interacts with the database, processes the data and sends it back to the controller. The controller then loads the corresponding view, which presents data to the user in a user-friendly format.

What is Laravel and why is it so popular?

Laravel is a PHP MVC framework known for its elegant syntax and rich features. It provides various tools for routing, authentication, sessions, caching and other tasks. Laravel also has a vibrant community and a large amount of documentation that makes it a popular choice for developers.

What is the learning curve of PHP MVC framework?

The learning curve of the PHP MVC framework may vary. Some frameworks like Laravel and CodeIgniter are known for their simplicity and are relatively easy to learn. Other frameworks such as Symfony and Yii2 may take more time to master because their functions and concepts are complex.

Can I use PHP without an MVC framework?

Yes, you can use PHP without an MVC framework. However, using frameworks can make your development process more efficient and your code is easier to maintain, especially in large applications.

What is database abstraction in PHP MVC framework?

The database abstraction in the PHP MVC framework refers to the practice of hiding the details of database operations to avoid affecting the rest of the application. This allows developers to interact with the database using a consistent API regardless of the underlying database system.

How to get started with PHP MVC framework?

To get started with the PHP MVC framework, you should first understand PHP and object-oriented programming basics. You can then choose a framework that suits your needs and start learning it through its official documentation, online tutorials, and community forums.

The above is the detailed content of The State of PHP MVC Frameworks in 2017. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template