How to get all routes in Laravel Application?

Share Me
  • 2
How to get all routes in Laravel Application

Hi Dev’s, Today now in this blog I will show you how to get all routes in laravel application. When we need to fetch all routes also with name and url properties then we can use getRoutes() method in php laravel 8 application.

We can use Route facade also with getRoutes() method for getting all the list of routes. Now we can do this simply and easily to get all routes also with route name, prefix, url properties and also path.

If we want get all routes then we can use “Route::getRoutes()” example as like as is bellow.

Example 1

public function getRouteList()
    $routeList = \Route::getRoutes();



RouteCollection {#37 
  #routes: array:3 []
  #allRoutes: array:11 [
    "HEAD_ignition/health-check" => Route {#149 }
    "POST_ignition/execute-solution" => Route {#148 }
    "POST_ignition/share-report" => Route {#152 }
    "HEAD_ignition/scripts/{script}" => Route {#153 }
    "HEAD_ignition/styles/{style}" => Route {#154 }
    "HEADapi/user" => Route {#205 }
    "HEAD/" => Route {#206 }
    "HEADdatepicker" => Route {#207 }
    "HEADhome" => Route {#208 }
    "HEADjquery-loadmore" => Route {#209 }
    "HEADcontact-us" => Route {#210 }
  #nameList: array:2 []
  #actionList: array:10 []

Now by using bellow command to get route list in command prompt.

Example 2

php artisan route:list

So perform above command to get list of all routes in command prompt.

Read Also : Add Charts Using Highcharts In Laravel 8

Thanks for read. I hope it help you. For more you can follow us on facebook.

About Shahriar Sagor

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Shahriar Sagor →