Skip to content

Instantly share code, notes, and snippets.

@silentworks
Created April 11, 2014 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save silentworks/10476273 to your computer and use it in GitHub Desktop.
Save silentworks/10476273 to your computer and use it in GitHub Desktop.
Get Slim protected routes out in a public function
<?php
namespace App\Vendor;
class Router extends \Slim\Router
{
/**
* Get all the defined routes
* @return array
*/
public function getRoutes()
{
$routes = array();
if (count($this->routes) > 0) {
/** @var \Slim\Route $route */
foreach ($this->routes AS $route) {
$routes[] = $route;
}
}
return new \ArrayIterator($routes);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment