-
-
Save pguso/e92a0769e5c1636eb8b3 to your computer and use it in GitHub Desktop.
Print routes and where they're defined for a silex app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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