How to get a list of registered route paths in Laravel?

Route::getRoutes() returns a RouteCollection. On each element, you can do a simple $route->getPath() to get path of the current route.

Each protected parameter can be get with a standard getter.

Looping works like this:

$routeCollection = Illuminate\Support\Facades\Route::getRoutes();

foreach ($routeCollection as $value) {
    echo $value->getPath();
}

Leave a Comment