What is a PHP framework and which one should I learn and use?
Framework is a tool to help you develop applications faster and better. It is a reusable set of libraries and/or classes. They usually define default folder structure of a project.
There are many existing, well established and secure open source frameworks with large communities behind them. Rather than reinventing the wheel many developers use them to built web applications. There is NO best and NO official PHP framework, because different purposes and different projects require different tools and approaches.
Using established existing open source framework is strongly advised when working in a team. Framework can provide developers same set of standards and better interoperability when they build application together.
Which framework should you learn?
Before diving into a PHP framework get yourself familiar with some advanced concepts such as OOP, design patterns, ORM, authentication, MVC (model view controller) etc. For bigger projects usage of popular open source frameworks instead of your custom one or procedural programming is advised.
Before understanding modern open source PHP frameworks check also Composer - a dependency Manager for PHP.
In your career path you will not need to know all of them but you should learn how to use few of the frameworks that are widely used in the industry or are important to you. Organizations and companies are always moving towards modern popular established frameworks so for predicting which framework will get you a job in PHP market today is a task for a prophet or a fortune teller - therefore it is almost impossible. You can check the popularity trends in PHP community and check the most popular ones (according to the stars on GitHub) but don’t get fooled by such comparison charts. Each organization can move towards something else sooner or later.
Learning some complex PHP frameworks can have a steep learning curve.
According to the architecture the framework itself is built upon there are three major types of frameworks we will use to categorize them in this FAQ:
Component frameworks are built and decoupled into separate components that you can use in your application independently on other components. You can just use some components or all of them. Most of component frameworks can be also a full stack framework (described in the next section) at the same time.
Full stack frameworks
Full stack framework includes everything you need to develop an application in one package. Decoupling of components is mostly not possible.
- Agile Toolkit
- Cygnite Framework
- Joomla Framework
- Simple MVC Framework
- Typo3 Flow
- Yaf - PHP framework written in C and built as an PHP extension
Micro-framework holds simple core with very lightweight infrastructure of classes and libraries. Main purpose of micro-frameworks is fast building of application and still keep lightning speed of performance with small footprint.
- Apigility - micro-framework based on Zend Framework
- Bullet PHP
- Flint - micro-framework built on top of Silex
- Kraken - Distributed and async PHP framework.
- Lumen - micro-framework by Laravel
- Phlyty - micro-framewok written using ZF2 components
- Proton - StackPHP compatible micro-framework
- Silex - micro-framework based on Symfony2 components
- API Platform - API-first web framework on top of Symfony with JSON-LD, Schema.org and Hydra support.
- Medoo - PHP Database Framework
- Zend Expressive - Minimalist PSR-7 middleware framework for PHP.
All the popular and the ones we have encountered in this group are listed above in alphabetical order.
- Why all PHP frameworks suck? - PHP frameworks criticism by Rasmus Lerdorf on phpclasses.org
- Frameworks inside communities - the war of “best” - blog post about “best” framework
Content of this work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license. Code snippets in examples are published under the CC0 1.0 Universal (CC0 1.0). Thanks to all the contributors.