Performance benchmark of popular PHP frameworks

There are many assumptions around performance of different PHP frameworks. I frequently hear strong opinions about superiority X over Y in this context. There are companies writing new PHP frameworks from scratch because available solutions are too slow for them. What does it really mean? Does the framework performance matters? Before answering this questions lets check how slow is your framework!

Performing a representative benchmark across different framework is not an easy task. There are multiple ways to use each of them. Every use case will give different reading. Lets take routing as an example. Zend1 by default doesn’t need a routing file. It’s happy to use “/controller/action” pattern. On the other hand Symfony2 comes with a routing configuration. The file has to be read and parsed. That obviously takes some additional CPU cycles but does it mean Symfony2 routing is slower then Zend1? The answer is (obviously) no.

I benchmarked “quick start” projects. That gives some idea on what is the base line for every framework and makes it possible to reproduce my tests (and argue against them).
Code was hosted on Amazon EC2 medium instance. I installed PHP-APC to avoid disc access and code parsing. I also made sure there is no I/O on Apache2 or application level. I set logs and cache paths to “/dev/shm/”. I tweaked projects to make them return roughly the same amount of data (10KB). All virtual hosts had the same mod_rewrite rules. AllowOveride was set to None.

Benchmarked frameworks:

PHP Frameworks benchmark

I’m not surprised, Slim is the fastest because it’s a micro framework. The Quick Start project didn’t use any templates or layout which obviously contributed to the reading.
Zend1 is twice faster than Symfony2 and Zend2 but in my experience the number will quickly go down in a real live setup.

Frameworks should speed up development, performance is a secondary concern. Zend 2 and Symfony2 could do better but it’s not bad. There are ways to improve those numbers on production servers. Don’t reinvent the wheel, learn and use frameworks. There are various options which balance between performance and features.

(http://systemsarchitect.net)

Awesome PHP Frameworks for Developers

It’s sometimes very hard to stay focus and organised if you don’t have a clear structure for your app from the very start and that’s why many developers pick a framework and stick with it without giving much thought of thinking outside that framework and trying a new one. But with saying that we seen many of the other developers branching out and finding a new one but finding that is sometimes the hardest part.

So today’s post features 8 awesome PHP frameworks that hopefully you may not have heard of, for you to choose from for your next project and before you asked I’ve didn’t include CakePHP & CodeIgnitier in today’s post as i feel like that you would be already use them or know of them.

1. Lithium

Lithium is the first and only major PHP framework built from the ground up for PHP 5.3+, and the first to break ground into major new technologies, including bridging the gap between relational and non-relational databases through a single, unified API.

Lithium takes full advantage of the latest PHP 5.3 features, including namespaces, late static binding and closures as it also gives you full control over your application, from filters to dynamically modify framework internals, to dynamic dependencies to extend and replace core classes with application or plugin classes, to heavy use of adapter-oriented configurations, to make it seamless to move between different technologies and options. Every component of the Lithium framework stack is replaceable through the robust plugin architecture.

Swap out the default ORM / ODM implementation for Doctrine 2 or PHP ActiveRecord and if you don’t like the templating you can use Twig, Mustache, or roll your own.

2. Phalcon

Phalcon is an open source, full stack framework for PHP 5 written as a C-extension, optimized for high performance. You don’t need learn or use the C language, since the functionality is exposed as PHP classes ready for you to use. Phalcon also is loosely coupled, allowing you to use its objects as glue components based on the needs of your application.

3. FuelPHP

Fuel is takes the best of all the frameworks that have come before and combining them into a fresh approach as it is is a simple, flexible, community driven PHP 5 web framework. FuelPHP was designed as a MVC (Model-View-Controller) framework to have full support for HMVC as part of its architecture but that didn’t stop there the people behind FuelPHP added ViewModels (also known as presentation models) into the mix which give you the option to add a powerfull layer between the Controller and the View.

With it out-of-the-box FuelPHP’s Views will encode all your output to make it secure and prevent XSS attacks and with almost every class in FuelPHP’s core package can be extended without you having to change a single line of code

4. Zend Frameworks

Zend Framework 2 is an open source framework for developing web applications and services using PHP 5.3+. Zend Framework 2 uses 100% object-oriented code and utilises most of the new features of PHP 5.3, namely namespaces, late static binding, lambda functions and closures.

With the component structure of Zend Framework 2 is unique; each of the component are designed with few dependencies on other components. It’s follows the SOLID object oriented design principle. This loosely coupled architecture allows developers to use whichever components they want. While they can be used separately all of the components in the standard library form a powerful and extensible web application framework when combined.

5. Symfony

Symfony is a full stack PHP 5.3 web framework that embodies a significant evolution when it compared with the first version of the framework as it is extremely light, only requiring two writing folders, which you can easily configure to the established level of security you want for your app. If you’re also playing the role of a system admin, you’ll be relieved to know Symonfy plays well with http accelerators like Varnish, and is a snap to configure with any database system you have chosen.

Symfony aims to speed up the creation and maintenance of web applications and to replace repetitive coding tasks as this framework also aimed at building robust applications in an enterprise context, and aims to give developers full control over the configuration: from the directory structure to the foreign libraries, almost everything can be customised.

6. Yii Framework

Yii is a free, open-source Web application development framework written in PHP5 that promotes clean, DRY design and encourages rapid development. It works to streamline your application development and helps to ensure an extremely efficient, extensible, and maintainable end product.

Being extremely performance optimized, Yii is a perfect choice for any sized project. However, it has been built with sophisticated, enterprise applications in mind. You have full control over the configuration from head-to-toe (presentation-to-persistence) to conform to your enterprise development guidelines. It comes packaged with tools to help test and debug your application, and has clear and comprehensive documentation.

7. Laravel

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, and caching.

8. Fat Free

Condensed in a single ~50KB file, F3 gives you solid foundation, a mature code base, and a no-nonsense approach to writing Web applications. Under the hood is an easy-to-use Web development tool kit, a high-performance URL routing and cache engine, built-in code highlighting, and support for multilingual applications. It’s lightweight, easy-to-use, and fast. Most of all, it doesn’t get in your way.

Whether you’re a novice or an expert PHP programmer, F3 will get you up and running in no time. No unnecessary and painstaking installation procedures. No complex configuration required. No convoluted directory structures. There’s no better time to start developing Web applications the easy way than right now!

F3 supports both SQL and NoSQL databases off-the-shelf: MySQL, SQLite, MSSQL/Sybase, PostgreSQL, DB2, and MongoDB. It also comes with powerful object-relational mappers for data abstraction and modeling that are just as lightweight as the framework. No configuration needed.

(The Creative Project)