News Feed
Sections




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

Matthias Noback:
Symfony2 Framework independent controllers parts 2 & 3
June 19, 2014 @ 09:45:34

Matthias Noback has posted the next two parts of his "framework independent controllers" series (it started here) looking at avoiding annotations and tying up some loose ends.

From part two about annotations:

In the previous part of this series we decreased coupling of a Symfony controller to the Symfony2 framework by removing its dependency on the standard Controller class from the FrameworkBundle. Now we take a look at annotations. They were initially introduced for rapid development (no need to create/modify some configuration file, just solve the issues inline!) [...] This might not seem such a big problem at all, but the SensioFrameworkExtraBundle is a bundle, which means it only works in the context of a Symfony2 application. We don't want our controller to be coupled like this to the framework (at least, that is the point of this series!), so we need to remove the dependency.

He shows how to decouple this functionality through a proper routing configuration, fetching the needed data yourself for the request and generating the request object yourself. In part three he covers some of the comments already made about the series and how to take the final steps to abstracting out the controllers: removing bundle names from templates, removing the HttpFoundation dependency and letting go of "action methods".

0 comments voice your opinion now!
controller independent symfony series part2 part3

Link: http://php-and-symfony.matthiasnoback.nl/tags/controller/

blog comments powered by Disqus

Similar Posts

SitePoint PHP Blog: IronMQ and Laravel: Delays and Retries

DZone.com: PHP Performance Crash Course, Part 2: The Deep Dive

ZFort Group: The Battle of the Titans. Zend vs. Symfony

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

Felix Geisendörfer's Blog: Make printing easy, using a PrintController


Community Events





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


deployment interview list library laravel tips symfony developer conference bugfix introduction voicesoftheelephpant series language release podcast community api framework zendserver

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