Laravel 9 How To Get All Application Routes Tutorial

Reading Time: 4 minutes

Inside this article we will see the concept i.e Laravel 9 How To Get All Application Routes Tutorial. Article contains the classified information about how to get all routes in laravel.

If you are looking for a solution i.e how to list all application routes in laravel then this article will help you a lot for this. Tutorial is super easy to understand and implement it in your code as well.

The route is a way of creating a request URL for your application. These URLs do not have to map to specific files on a website, and are both human readable and SEO friendly.

Read More: Laravel 9 Redirection with Form Inputs Example Tutorial

Let’s get started.

Laravel Installation

Open terminal and run this command to create a laravel project.

composer create-project laravel/laravel myblog

It will create a project folder with name myblog inside your local system.

To start the development server of laravel –

php artisan serve


Assuming laravel already installed inside your system.

Create Controller

Back to project terminal and run this command to create a controller file.

$ php artisan make:controller SiteController

Above command will create a file i.e SiteController.php inside /app/Http/Controllers folder.

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
class SiteController extends Controller
     * Write code on Method
     * @return response()
    public function index()
        $routes = Route::getRoutes();
        return view('routesList', compact('routes'));

Create Blade Template File

Create a file routesList.blade.php inside /resources/views folder.

Read More: CodeIgniter 4 Redirection with Form Inputs Example Tutorial

Open view file and write this code into it.

<!DOCTYPE html>

    <title>Laravel 9 How To Get All Application Routes Tutorial</title>
    <link href="" rel="stylesheet">


    <div class="container">
        <h3 style="text-align: center;">Laravel 9 How To Get All Application Routes Tutorial</h3>
        <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>




Create Route

Open web.php file from /routes folder. Add this route into it.


use App\Http\Controllers\SiteController;

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


Application Testing

Run this command into project terminal to start development server,

php artisan serve


We hope this article helped you to learn Laravel 9 How To Get All Application Routes Tutorial in a very detailed way.

Read More: CodeIgniter 4 How To Redirect with Flashdata Example Tutorial

Online Web Tutor invites you to try Skillshike! Learn CakePHP, Laravel, CodeIgniter, Node Js, MySQL, Authentication, RESTful Web Services, etc into a depth level. Master the Coding Skills to Become an Expert in PHP Web Development. So, Search your favourite course and enroll now.

If you liked this article, then please subscribe to our YouTube Channel for PHP & it’s framework, WordPress, Node Js video tutorials. You can also find us on Twitter and Facebook.