At Venditan, we like to keep up with the latest technology to assist us to build fantastic websites for our clients. In January of last year, the stable 2.2.9 release Yaf (Yet Another Framework) was released and we just had to have a play. Yaf is the first PHP MVC framework to be written in C and built as a PHP extension. The framework was written by laruence, who is also a PHP development team member leading APC development. It is considered the fastest and lowest resource consuming PHP framework around at the moment, and has been well tested in production applications in a number of large organisations.
As of now, we have three websites in production that are implemented using Yaf, and the performance is incredible, not that this is unexpected since it’s written in C. The benchmarks completed on Yaf are also overwhelming, with one result showing that Yaf is able to make 5331 requests per second, opposed to 634 requests per second for Zend, and 2300 requests per second for CodeIgniter.
Caught your attention? I hope so, but where to start? Yaf is a PECL extension and as such is easy to install. The documentation available is fairly limited, with the most detailed documentation written in Chinese which proves a little difficult to understand using Google Translate. We were fortunate enough to find some example PHP applications on Github which we were able to review to help us write our first sample application. I found the following flowchart helped me understand Yaf better and allowed me to see Yaf’s support for Bootstrap and its plug-in mechanism.
Over the past year, we have written a Yaf application that uses our SprintSDK to communicate with the SprintEcommerce API. We have extended on the Yaf Route Interface, allowing us to manage the routing based on responses from the API. Adding to the router stack within the Bootstrap is very simple and documented well within the PHP Docs.
In future posts we will look at the benchmarks in greater detail and how we overcame issues such as multiple template sets, but I hope this quick look at Yaf has inspired you to take a closer look.
2nd Apr 2015