Skip to content

Instantly share code, notes, and snippets.

@igorw
Created March 24, 2011 21:14
Show Gist options
  • Save igorw/885908 to your computer and use it in GitHub Desktop.
Save igorw/885908 to your computer and use it in GitHub Desktop.
<?php
require_once __DIR__.'/silex.phar';
use Silex\Application;
$app = new Application();
$app->get('/hello', function() {
return 'get hello';
});
$app->put('/hello', function() {
return 'put hello';
});
return $app;
<?php
$app = require __DIR__.'/app.php';
$routeCollection = $app->getRouteCollection();
foreach ($routeCollection->all() as $name => $route) {
$requirements = $route->getRequirements();
$method = isset($requirements['_method']) ? strtoupper(is_array($requirements['_method']) ? implode(', ', $requirements['_method']) : $requirements['_method']) : 'ANY';
var_dump(array($method, $route->getPattern()));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment