News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Fabien Potencier's Blog:
Create your own framework... on top of the Symfony2 Components (part 9)
January 19, 2012 @ 08:58:11

Fabien Potencier has posted the ninth part of his "build a framework on Symfony2 components series. In this latest tutorial he takes the simple framework he's already created (complete with some unit tests) and makes it easier to extend.

Our framework is still missing a major characteristic of any good framework: extensibility. Being extensible means that the developer should be able to easily hook into the framework life cycle to modify the way the request is handled.

He chooses the Observer design pattern as a basis for his example, allowing any kind of behavior/actions to be added to the framework's execution. He includes the Symfony2 dispatcher to make this work and includes the code for a "handle" method to fire off events. It executes a "ResponseEvent" every time the framework is executed. An "addListener" method provides the hook to apply a callback to an event - in his case an anonymous function (or closure).

0 comments voice your opinion now!
symfony2 framework custom series extensible observer designpattern


blog comments powered by Disqus

Similar Posts

Symfony-framework.com: Symfony 1.1 - What’s new?

Kowser's Blog: Kohana Tutorial: For the beginners

PHPMaster.com: Laravel: Is It Really Clean and Classy?

Fabien Potencier's Blog: Create your own framework... on top of the Symfony2 Components (part 2)

Community News: "Laravel: From Apprentice To Artisan" Book Release


Community Events





Don't see your event here?
Let us know!


podcast example laravel release security community conference voicesoftheelephpant tool series framework composer opinion introduction interview version library language symfony list

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework