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 12)
January 25, 2012 @ 08:36:48

In this final post of his series about building a framework on Symfony2 components, Fabien Potencier focuses again on flexibility - allowing you to have more than one front controller with different configurations thanks to dependency injections.

Does it means that we have to make a choice between flexibility, customization, ease of testing and not having to copy and paste the same code into each application front controller? As you might expect, there is a solution. We can solve all these issues and some more by using the Symfony2 dependency injection container.

The Symfony2 DIC (DependencyInjection) allows you to create a container with the objects and settings that you want and inject that into the main "Framework" class for its use. He registers most of the components he's added over the series like the UrlMatcher, RouterListener, ExceptionListener, EventDispatcher and the Framework class itself. This is all stored in a separate file(s) and can be conditionally included based on your environment. He shows how to register a custom listener, add parameters to the DIC configuration.

0 comments voice your opinion now!
symfony2 framework component custom tutorial series dependency injection


blog comments powered by Disqus

Similar Posts

Padraic Brady's Blog: Zend Framework Blog Tutorial - Part 6: Zend_Form & Zend_Auth

Ligaya Turmelle's Blog: Quick snip (or Zend Framework in a Subdirectory)

Abhinav Singh's Blog: Get real time system & server load notification on any IM using PHP and XMPP

Mike Purcell's Blog: Symfony - PHP - Possibly Forking 1.x so Invested Companies donít Lose Millions

SitePoint PHP Blog: The Joy of Regular Expressions [1]


Community Events





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


community podcast introduction release install configure laravel list unittest developer interview series threedevsandamaybe code symfony2 language opinion refactor framework testing

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