I am trying to do something using Silex (which uses the Symfony routing component - so the answer might apply to Symfony too)
I am adding Silex to an outdated application for providing routing, but I need to respect the existing default application implementation for downloading files (this is just downloading a file from the file system with the specified URL).
edit: to clarify: An existing file is downloaded from the file system as included in the parent template after a series of bootstrap calls have been completed.
What I find is that in the absence of a specific route for matching outdated pages, Silex throws an exception.
I really need a way to provide a default (fallback) mechanism to handle these old pages, but my template should match the entire URL (and not just one snippet).
Is it possible?
// Include Silex for routing require_once(CLASS_PATH . 'Silex/silex.phar'); // Init Silex $app = new Silex\Application(); // route for new code // matches for new restful interface (like /category/add/mynewcategory) $app->match('/category/{action}/{name}/', function($action, $name){ //do RESTFUL things }); // route for legacy code (If I leave this out then Silex // throws an exception beacuse it hasn't matched any routes $app->match('{match_the_entire_url_including_slashes}', function($match_the_entire_url_including_slashes){ //do legacy stuff }); $app->run();
This should be a common precedent. I am trying to provide a way to have a RESTFUL interface along with legacy code (load / myfolder / mysubfolder / my_php_script.php)
symfony routing silex
calumbrodie
source share