Skip to content

Instantly share code, notes, and snippets.

@glsee
Created November 20, 2012 01:08
Show Gist options
  • Save glsee/4115284 to your computer and use it in GitHub Desktop.
Save glsee/4115284 to your computer and use it in GitHub Desktop.
Sample Silex app that has routing problem
// myapp/app/app.php
// ...
// route definitions
$app->mount('/myapp/subscribers', include 'controller/subscriber.php');
// later I tried these:
// this works
$app->get('/myapp/test/', function() {
// do something
});
// these do not work
$app->get('/myapp/{var}/', function($var){
// do something
});
$app->get('/myapp/test/{var}/', function($var){
// do something
});
// ...
// myapp/app/controller/subscriber.php
// ...
$subs = $app['controllers_factory'];
// this works
$subs->post('/', function (Application $app, Request $request) {
// do something
});
// this does not work
$subs->match('/{mobile}/', function (Application $app, Request $request, $mobile) {
$mobile = $app->escape($mobile);
// do something
})->method('GET|PUT|DELETE');
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment