Skip to content

Instantly share code, notes, and snippets.

@davedevelopment
Created June 6, 2012 21:36
Show Gist options
  • Save davedevelopment/2884984 to your computer and use it in GitHub Desktop.
Save davedevelopment/2884984 to your computer and use it in GitHub Desktop.
Print routes and where they're defined for a silex app
#!/usr/bin/env php
<?php
# bin/routes
$app = require __DIR__ . '/../app/bootstrap.php';
$routes = $app['routes']->all();
foreach($routes as $route) {
$cr = new ReflectionFunction($route->getDefault('_controller'));
echo sprintf("%s %s => %s@%d\n",
$route->getRequirement('_method'),
$route->getPattern(),
str_replace(dirname(__DIR__) . '/', '', $cr->getFileName()),
$cr->getStartLine()
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment