How to Get All Routes in Laravel?

By Hardik Savani November 5, 2023 Category : Laravel

Hello Friends,

This tutorial shows you how to get all routes in laravel. In this article, we will implement a how to list routes in laravel. We will look at an example of laravel get all routes list. I explained simply step by step laravel routes list.

You can use this example with laravel 6, laravel 7, laravel 8, laravel 9 and laravel 10 versions.

I will give you a simple example of how to get an all routes list in laravel application. we will use getRoutes() function of Route facade to get list of all routes in laravel.

So, without further ado please check the below steps:

Step 1: Create Route

In this step, we will add one get-all-routes route to display all routes in laravel. So, let's add a new route to that file.



use Illuminate\Support\Facades\Route;

use App\Http\Controllers\DemoController;



| Web Routes



| Here is where you can register web routes for your application. These

| routes are loaded by the RouteServiceProvider within a group which

| contains the "web" middleware group. Now create something great!



Route::get('get-all-routes', [DemoController::class, 'index']);

Step 2: Create Controller

in the next step, now we have created a new controller as DemoController and write index method on it like as below, So let's create a controller:



namespace App\Http\Controllers;

use Illuminate\Http\Request;

use Illuminate\Support\Facades\Route;

class DemoController extends Controller



* Write code on Method


* @return response()


public function index(Request $request)


$routes = Route::getRoutes();

return view('routesList', compact('routes'));



Step 3: Create Blade File

In this step, we need to create one blade file with routesList.blade.php to display all routes, so let's update following code on it:


<!DOCTYPE html>



<title>How to Get All Routes in Laravel? -</title>

<link href="" rel="stylesheet">



<div class="container">

<h1>How to Get All Routes in Laravel? -</h1>

<table class="table table-bordered data-table">










@foreach($routes as $route)


<td>{{ $route->methods()[0] }}</td>

<td>{{ $route->uri() }}</td>

<td>{{ $route->getName() }}</td>

<td>{{ $route->getActionName() }}</td>








Run Laravel App:

All the required steps have been done, now you have to type the given below command and hit enter to run the Laravel app:

php artisan serve

Now, Go to your web browser, type the given URL and view the app output:



I hope it can help you...

Tags :