Skip to content

Instantly share code, notes, and snippets.

@hertsch
Last active April 26, 2017 08:28
Show Gist options
  • Save hertsch/5268848 to your computer and use it in GitHub Desktop.
Save hertsch/5268848 to your computer and use it in GitHub Desktop.
Silex: get a list of all routing URI patterns
// get all routing objects
$patterns = $app['routes']->getIterator(); // seems to be changed in Silex 1.1.0 !!! ... ->current()->all();
// walk through the routing objects
foreach ($patterns as $pattern) {
$match = $pattern->getPattern();
echo "$match<br />";
}
@gbirke
Copy link

gbirke commented Apr 26, 2017

If you want to list the routes before you have handled a request, you neeed to call $app->flush();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment