How to list all routes in Laravel ?

getRoutes() method of Route Facade is used to list all routes in Laravel. Below are sample usage

Example usage:

$routeCollection = Route::getRoutes(); // returns route collection

foreach ($routeCollection as $value) {
    echo $value->getPath();//returns route path
}

Leave a Reply

Your email address will not be published. Required fields are marked *