The Best PHP Frameworks For 2020 (and Beyond)

PHP has come a long way in the last 25 years. What used to be a relatively under-powered scripting language has now become a powerful tool to build complex applications.

It’s no wonder, then, that PHP is one of the most popular choices for web applications around the world and that a whole slew of PHP frameworks have emerged over the past decade and a half.

In this article, I’ll go over the 10 best PHP frameworks for 2020 and some of their defining features. Use this as a guide to selecting the right framework for your project.

Why Use a PHP Framework?

When it comes to building quality software, you do not want to reinvent the wheel each time you need to solve a problem. Instead, developers like us leverage frameworks to speed up their development process.

But it’s not just speed of development that you benefit from when using a framework. You get to enjoy the battle-tested best practices that have taken many years and countless man-hours of toil to achieve.

Frameworks help you build more secure and scalable applications. They also make it easier for you to stay in sync with programming language updates and defect fixes. And the best part? Most of them are free and open source.

Let’s have a closer look at some of the best frameworks available today.

1. Laravel

Kicking off our list is Laravel - a highly functional MVC (model–view–controller) framework with a rich ecosystem of extensions.

Some notable apps in the Laravel suite that will make your life easier include:

  • Cashier - a way to integrate Stripe payments into your application and speed up the development of subscriptions and billing functionality.
  • Forge - a server management app that reduces headaches when deploying to Amazon, DigitalOcean, and other hosting platforms. Forge installs Nginx, PHP, MySQL, Postgres, and Redis for you on your cloud servers, which means less time spent troubleshooting errors and configurations. Truly a Godsend!
  • Telescope - a debug assistant to help you track down bugs by providing insight into application requests, exceptions, log entries, database queries, queued jobs, mail, notifications, cache operations, scheduled tasks, and other relevant operations.
  • Vapor - a serverless deployment platform for Laravel powered by Amazon Web Services (AWS) that allows you to auto-scale your app with ease.

Of course, other out-of-the-box features that you’d expect with a framework of this caliber are included such as unit testing, templating, scaffolding, queue monitoring, and authentication.

The latest Laravel version (7.0) works with PHP 7.2.5 and higher, so you get all the latest improvements.

Keep in mind, however, that Laravel does not work on shared hosting plans, so if you use a standard GoDaddy or other hosting solution, you may need to think about upgrading to a dedicated server.

One of the best things about Laravel is how easy it is to get started with the platform. The documentation is robust. The community is very strong as well, with various blogs and podcasts for you to consume as well as forums and conferences to attend.

2. Laminas Project

The Laminas Project, formerly known as the Zend Framework, is a powerful enterprise-ready, secure, and extensible PHP framework that also leverages the ever-more-popular MVC architecture.

While probably overkill for most small-scale purposes, if you need to build a complex application, then look no further.

Laminas Project’s tools allow you to build RESTful APIs and middleware with ease. The extensive set of components help you to quickly integrate essential functionality into your solution.

Some key features and components include:

  • Dependency injection
  • Logging
  • Event dispatchers
  • Input validation and filtering
  • Pagination and navigation
  • Feed generation and parsing
  • Internationalization and translations
  • Memory management
  • Routing
  • Serialization
  • Application diagnostics

3. CodeIgniter

With its tiny footprint of only several megabytes, CodeIgniter is simple but powerful. Do not let its small size deter you from considering it when building your PHP application.

CodeIgniter is a high performance framework that requires almost no configuration to get going. This makes it quick and painless to integrate into your workflow and start coding right away.

CodeIgniter is just the framework to use if you’re starting out with PHP or are looking to build some backend functionality for your website. The framework integrates well with MySQL, and you can deploy it on regular web hosting services.

While it supports MVC, CodeIgniter does not force you to use it, which means you have plenty of flexibility and leeway in how you leverage its capabilities.

In terms of security, the framework has several in-built features that will help you protect your applications from attacks such as cross-site scripting (XSS) and cross-site request forgery (CSRF).

4. CakePHP

CakePHP has been around for 15 years, so you can bet that it has been tried and tested. It also follows the MVC approach and is packed full of useful tools and components that will make the development of your apps a smoother process.

Some of these capabilities include:

  • Code generation and scaffolding
  • Easy configuration
  • Authentication
  • Object-relational mapping
  • Various tools to help you secure your applications (e.g. input validation, and CSRF, form tampering, and SQL injection protection)

There is great value in using boilerplate or generated code and having to do minimal project set-up and configuration. It means you have more time to focus on solving the problem your application intends to solve.

The latest CakePHP version (4.0 Strawberry) requires you to use PHP 7.2, which may require some effort to migrate if you’re already working on a project built using an older version of PHP.

If you’re going greenfield with it, however, then you’re going to enjoy the many new features of the latest update.

5. Symfony

Symfony is not just a high-performance PHP framework for web projects. It’s also a set of 50 stand-alone PHP components that you can use in your applications (regardless of whether they were built on Symfony or not).

These stand-alone components include various timesaving and functional libraries that you can use to:

  • Secure your applications
  • Run unit tests
  • Route and manage requests
  • Crawl and process HTML and XML documents
  • Handle errors
  • Incorporate messaging into your app
  • Access the file system

Next time you need to solve any of the above, you know where to look for some assistance.

Symfony’s advanced features are loved by many thousands of developers around the world. In fact, Laravel was built on Symfony.

While the learning curve is somewhat steeper with Symfony than other frameworks because of the advanced features, Symfony's documentation is great and the community of hundreds of thousands of developers is vibrant. So, you can rest assured you will be well supported.

6. FuelPHP

FuelPHP is a secure and extensible MVC framework that was designed be modular and flexible, while implementing the best practices and features of other frameworks. Beyond MVC, it also supports HMVC (hierarchical model–view–controller).

HMVC has many useful applications on the web, particularly when you have multiple parts on a webpage that need to access data from different sources (feeds, widgets, etc).

The developers have also added ViewModels - you may know them as presentation models or the MVVM (model–view–viewmodel) architecture.

These allow you to add a layer between your controller and the view, which enables you to keep the view logic separate from your views and controllers. When done right, the end result is more a manageable application and reduced complexity.

In terms of its security features, you get these out of the box:

  • Input filtering
  • URI filtering
  • XSS filtering
  • Output encoding
  • CSRF token protection
  • SQL injection prevention
  • A secure Auth framework

Another awesome feature of FuelPHP is the authentication framework. If your application relies heavily on authentication, or various roles and groups need to be set up, you will find the tools included in FuelPHP incredibly helpful.

7. Yii Framework

The Yii Framework positions itself as a fast, efficient PHP framework that allows you to build low-overhead, secure applications.

The starter project template you get when you install it is a testament to that ethos. Built with a Bootstrap UI, it supports MVC, has included login functionality, a debugger, and several static pages including a contact form.

A lot of the configuration work has also already been done for you, so you can get to coding faster. You can even use the code generator to generate models and CRUD functionality with ease.

The Yii developer resources and community are impressive. There are tons of tutorials and examples you can use to ramp up your knowledge of the framework. There are also many third-party extensions contributed by the community that you will find useful.

8. Phalcon

Phalcon is another MVC framework but is somewhat unique within the group we’re discussing here.

It is implemented as a web server extension and was written in C, which allows for coding closer to the hardware. In other words, this allows the developers to make the application or framework faster and less resource-intensive by reducing computational overheads, memory consumption, and speeding up requests and transactions.

In this case, the developers certainly did this well, making Phalcon the fastest PHP framework out there. This speed is achieved in part by having the code that is deployed already compiled to a specific platform and processor, rather than having to be interpreted as the application receives requests.

Naturally, this means requests are served much more quickly.

Phalcon has all the core features and tools you would expect, including:

  • MVC and HMVC
  • Object-relational mapping
  • Dependency Injection
  • Caching
  • Template engines
  • Routing
  • Encryption
  • A forms builder

There is plenty of documentation to help you get the most of the framework and you can interact with the community on pretty much all social media channels out there.

9. Fat-Free Framework

Along with its cool name, the Fat-Free Framework has a bunch of cool features to help you build powerful web applications.

The code base is extremely light at just about 65kb, and installation and configuration are easy. But this should not give you the impression that the framework is missing some important core components.

Here is a sample of what’s on offer:

  • Out of the box support for SQL and NoSQL
  • Template engine
  • Unit testing toolkit
  • Markdown-to-HTML converter
  • Atom/RSS feed reader
  • Image processor
  • Geodata handler
  • On-the-fly JavaScript/CSS compressor
  • Custom logger
  • Basket/Shopping cart
  • Pingback to a server/consumer
  • Unicode-aware string functions
  • SMTP over SSL/TLS
  • Tools for communicating with other servers
  • Data Validation

All that is before we even take a look at the various plugins the community has contributed.

Overall, if your goal is to develop a functional but light-weight app, the Fat-Free Framework should certainly be on your shortlist of candidate frameworks.

10. Slim

When you need to build RESTful APIs or apps that use web services, you will want to consider Slim because it is one of the fastest ways you can get started.

With this PHP micro framework, you can consume data from various sources, apply your own logic to it, and publish it back to your apps or expose it to other consumers.

In the past we’d have to code all of this ourselves, but those days are gone. Slim’s powerful features do much of the heavy lifting for you by handling operations such as:

  • Routing
  • Error handling
  • Method overriding
  • Output buffering
  • HTTP caching
  • Parsing

While robust PHP frameworks like the ones we covered at the start are great for complex apps, lightweight frameworks like Slim are perfect for when you need to build low-overhead APIs and web services that serve a specific and limited purpose.

Final Thoughts

In this article, I presented you with the 10 best PHP frameworks for 2020 that you can leverage to build your apps. Your choice on which one to use in your project largely depends on the complexity of the problem you’re trying to solve.

Naturally, certain frameworks are more suited for enterprise-grade applications, while others are more suited for lightweight and fast web apps for startups and small companies.

After evaluating your project requirements and the various PHP framework options, you should be in a much better position to make a decision.

If you enjoyed this article, be sure to join my Developer Monthly newsletter, where I send out the latest news from the world of Python and JavaScript:


Written on April 21st, 2020