Laravel 4 ships with the php artisan routes
command. This shows a list of registered routes on the command line. Instead of showing the registered routes on the command line, I would like to get its values within a controller.
The following method does exactly what I want:
Illuminate\Foundation\Console\RoutesCommand()
Unfortunately this is a protected method, so it doesn't work when I try something like this:
$rc = new Illuminate\Foundation\Console\RoutesCommand(new Illuminate\Routing\Router);
print_r($rc->getRoutes());
How can I access this method to display the registered routes in my Laravel 4 app?
Or even better; how can I access methods of any autoloaded service provider?
You can get all routes like this: