Since working with Evgeniy on our recent article, Five Challenges of CSS Front-End Development, I...
Which PHP Framework Should I Choose?
Web development nerds are lazy – and that’s a good thing! Programmers build on proven software. ‘Don’t reinvent the wheel’ is an adage they take to heart, and frameworks are the result.
What is a PHP Framework?
PHP frameworks simplify web coding tasks by providing components – such as for user authentication – that make standard website elements easy to implement and maintain. They free up developers to focus their time on the details that set your website and business apart from the crowd by cutting out time that would otherwise be spent developing more basic levels of website functionality.
“A framework is a pledge of quality, upgradability and maintainability of applications at lower cost,” according to Symfony’s website. Laravel promises “Elegant applications delivered at warp speed.” PHP frameworks facilitate agile software development – meaning faster deployment – and are easier to maintain than proprietary solutions.
The four most-used frameworks that PHP development companies rely on today are Symfony, Laravel, Zend, and Yii, though there are many other options out there to explore if you’re feeling adventurous.
5 Questions to Ask When Choosing a PHP Framework
Committing to a PHP framework takes some consideration. Keep these five questions in mind the next time you’re creating web pages with PHP:
1. What functionality do I want a framework to provide? (What ‘components’ am I looking for?)
2. What communities exist around the framework in question?
3. How actively is the framework developed? (Who supports it?)
4. What learning curve will be involved? (Does our PHP developer portfolio include experience with this framework?)
5. Are there any larger business implications of selecting a given framework?
Four Popular PHP Frameworks – Symfony, Zend, Yii, and Laravel
Note: All frameworks reviewed here are provided under an open source license.
Symfony is developed by SensioLabs, a French-based PHP development company. SensioLabs offers Symfony training courses in various locations and languages, as well as an exam-based Symfony Certification.
The Symfony team offers a frequently updated blog with weekly development highlights, and stresses that their framework is maintained within an active community. This is evidenced by an official SensioLabsConnect user community that claims to represent “a passionate group of over 300,000 developers from more than 120 countries,” about 27.4k tagged questions on StackOverflow, and many other unofficial support and development communities around the web.
Symfony has a significant learning curve – partly a result of its abundant features – though it may be eased with help of a large and active support and development community.
Consider Symfony if you’re looking for:
- a feature-rich framework;
- enterprise-level stability;
- LTS releases (and minor version releases every 6 months);
- required unit tests for all changes between versions to increase reliability;
- a clear roadmap for maintenance of Symfony versions;
- the largest numbers of bundles out of all available frameworks;
- flexibility to implement only select components (you don’t have to deploy the full stack);
- official training courses and certifications.
Like Symfony, Zend Framework 2 allows components to be implemented a la carte, and is also the product of a web development company by the same name. Zend calls its approach “a ‘use-at-will’ design,” and stresses the significance of its object-oriented code that “follows the SOLID object oriented design principle.” The takeaway: components are designed from the ground up to be able to exist independently. Even though Zend and Symfony are competing frameworks, it is quite possible to use elements from both in the same project.
Consider Zend if you’re looking for:
- excellent enterprise-level stability;
- partnership with big industry players including Google, IBM, and Adobe;
- great session control;
- availability of Zend Studio IDE ($189-328 for commercial use);
- official training and certification opportunities.
Yii is supported by an international development team, not backed by a company. According to Mashable, Yii “has powerful caching support and is explicitly designed to work efficiently with AJAX.” Yii stresses that its functionality can be extended with components from other frameworks, specifically citing how its class naming conventions avoid naming conflicts.
Consider Yii if you’re looking for:
- MVC design pattern;
- efficient error handling;
- AJAX support;
- a community-developed framework;
- design that minimizes integration hassles with third-party components;
- fast performance.
Laravel positions itself as “the PHP framework for web artisans.” Built on Symfony components, Laravel wants to be your go-to framework for convenient and beautiful web coding. Writing for SitePoint, Bruno Skvorc suggests that “on average, the Laravel community seems to mostly favor the ease of entry – virtually no learning curve.” But don’t let the ease of entry fool you – Laravel is a serious framework, as evidenced by its meteoric rise in popularity since its release just four years ago.
Consider Laravel if you’re looking for:
- a framework that is easy to learn;
- simple unit testing;
- Composer for dependency management;
- a rising star in the PHP community;
- excellent Laracasts training materials (only $9 per month).
Performance of Frameworks
Gauging performance of PHP frameworks is difficult because real-world use cases always differ from test cases, and because the underlying technologies differ enough that they are not directly comparable. Nevertheless we can suggest that Laravel and Yii offer similar performance results that are somewhat faster than Symfony and Zend. This may be largely attributed to their being ‘lighter’ frameworks. Your mileage may vary depending on your specific use cases.
Frameworks are Helpful, not Compulsory
Keep in mind that frameworks are not required for every web development project, but for many projects the right PHP framework can save many valuable hours and web coding headaches. Take a look at Symfony 2, Zend 2, Yii, and Laravel, and read up on other frameworks as well. Take what you like and keep the rest in mind for another day.