Skip to content

Instantly share code, notes, and snippets.

@realityking
Created March 19, 2013 22:46
Show Gist options
  • Save realityking/5200858 to your computer and use it in GitHub Desktop.
Save realityking/5200858 to your computer and use it in GitHub Desktop.

The decoupled Symfony components have been a great help but there are a few things in FrameworkBundle that could be moved to the components with some small refactoring making them more useable for people like me who have to use the components without the full framework.

There's a pretty good chance I'm overlooking something with some of these and there are certainly backwards compatibility concerns to be adressed.

Let's dig in:

Router and RouterCacheWarmer

The warmUp() method from the Router class could be dropped (also the WarmableInterface), the code would move RouterCacheWarmer. With this change RouterCacheWarmer only depends on HttpKernel and Routing and could go into either of these components. (My favorite would be Routing)

TemplateFinderInterface

This one is a bit of an odd duck since the implementation very much belongs into the FrameworkBundle. But by moving the interface to the Templating component.

The reason for this is that I wrote a SmartyBridge and doesn't depend on the FrameworkBundle like the existing SmartyBundle. I'd like to add a CacheWarmer though and having this interface would allow for a CacheWarmer that easily scales up to the full framework. The same would apply for Twig.

EngineInterface

This one could easily be moved to Templating, it just provides some nice integration between Templating and HttpFoundation's Response class.

This would be very handy for standalone use and probably use in Silex (which AFAIK doesn't use the Templating component right now).

The Interface would need a new name so we don't get a hard dependency on HttpFoundation into Templating.

Templating helpers

I don't use the PhpEngine myself but I don't see why the following helpers couldn't be moved to Templating or their respective Component:

  • RequestHelper
  • SessionHelper
  • TranslatorHelper
  • FormHelper

Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment