- URL: https://www.laruence.com/en/2010/09/04/1736.html
- Please include attribution when republishing.
It's been almost a month since I last updated the blog — partly because recent projects have been intense, and partly because I've been busy developing Yaf (Yet another Framework).
All along I've been studying the PHP internals. I've written quite a few articles, but there have been few actual things built on top of that research — which means fewer people get to learn how the Zend API is used in practice.
I thought about it for a while and decided it was worth writing an extension. This extension would make heavy use of the Zend API and cover many parts that PHP extension tutorials online rarely touch on (such as implementing classes/interfaces, inheritance, autoloading, and so on), so more PHP extension developers could learn from it.
Finally, considering that there are many PHP frameworks today, and many excellent ones among them — such as Zend Framework (I single it out because Yaf was modeled after ZF). These frameworks use many of the new techniques available since PHP 5. So if I write a framework like them as an extension, it not only serves the tutorial goal I had in mind, but also goes a long way toward solving the framework performance problem.
As for why it's called Yaf — I simply couldn't think of a better name, so I borrowed Yacc's naming convention and went with (yet another framework).
Note: Yaf 2.0 is now complete, with an entirely new architecture and design. It has passed systematic testing and is already in use across multiple product lines at my company. Please stop using 1.0; 2.0 will be released once the documentation is ready.
Yaf abstracts the non-varying parts of a framework and provides flexible, adjustable interfaces, implementing the following interfaces/classes similar to Zend Framework:
Yaf_Application Yaf_Controller Yaf_View Yaf_Request Yaf_Bootstrap Yaf_Route Yaf_Config Yaf_Registry Yaf_IView Yaf_Exception
It also adopts the same dispatchLoop approach as ZF, and supports Bootstrap and Plugin. Of course, for optimal performance, some interface classes and the parameter types at call time were changed.
For details, see: Yaf at PHP.net
Github: Yaf at Github
PECL: Yaf at PECL
And a Chinese manual: Yaf 中文手册
It's released now for you all to find flaws and offer suggestions, and I hope interested people will join in.
Finally, I hope Yaf can become a successful PHP framework — and also a good sample/example of a PHP extension.
Be First to Comment