Download the PHP package glaubinix/symfony-template-response without Composer
On this page you can find all versions of the php package glaubinix/symfony-template-response. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download glaubinix/symfony-template-response
More information about glaubinix/symfony-template-response
Files in glaubinix/symfony-template-response
Package symfony-template-response
Short Description symfony template response silex
License MIT
Informations about the package symfony-template-response
symfony-template-response
Using the TemplateResponse will help you to build Controllers which are not tightly coupled to a certain Framework. In the case of Symfony/Silex this mostly means not injecting the ServiceContainer/Application to your Controllers.
Installation
The easiest way to install this library is to use Composer. Add the package "glaubinix/symfony-template-response" to your composer.json.
Usage
To be able to use the TemplateResponse simply register the Listener.
Usage with symfony framework bundle
If you are using the framework bundle simply add this to your service config. `
Usage with silex and twig
If you are using silex make sure the templating Engine is registered then register the ServiceProvider which is provided with this library.
``
Notes
To make this fully decoupled from Frameworks the TemplateResponse would not have to extend the Symfony Response and instead of simply rendering the content we would have to replace the Response. Once this is done a dedicated ResponseListener for every Framework would allow the usage in all Frameworks.
Maintaing sounds like a huge pain and I dont really see this happening :)
Original idea
First time I saw this idea was in QafooLabsNoFrameworkBundle the implementation is slightly different and depends on the symfony framework bundle which is main the reason I build a simple version for silex.
