News Feed
Sections




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

Gonzalo Ayuso:
Scaling Silex applications
February 12, 2013 @ 09:54:54

Gonzalo Ayuso has posted yet another helpful Silex hint for those using this microframework and wanting to scale up their applications past the prototype stage - an extension to allow route definition in a YAML configuration.

My idea is to store this information within a Service Container (we will use Symfony's DIC). For example here we can [define] our routes.yml. [...] We need to implement one Extension for the alias "routes". We only will implement the needed functions for YAML files in this example.

He includes the code for the extension ("SilexRouteExtension") that can be used to parse the "routes.yml" file to inject the custom routing into your application. This includes the pattern to match, the controller to route it to and the target method. You can also set some requirements like the request method (in this case "GET").

0 comments voice your opinion now!
scale silex extension yaml route configuration file


blog comments powered by Disqus

Similar Posts

Padraic Brady's Blog: ext/snarl: PHP interface to the Windows Snarl Notification Tool API

Vidyut Luther\'s Blog: Where do you \"define\" your environment/global settings?

William Candillon's Blog: Running Zorba with PHP

Ilia Alshanetsky's Blog: Filter Extension Revamped (and PHP 5.2 news)

PHPMaster.com: Exploring PHP’s IMAP Library, Part 2


Community Events

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


interview extension series voicesoftheelephpant laravel podcast api unittest opinion framework example xdebug version introduction library php7 release install language community

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