Routing — The GPS of Your Laravel Application
In the previous article, we installed Laravel 13 and created our first route. Now it's time to go deep. Routing is the most fundamental concept in Laravel — every single request your application receives passes through the routing system first.
Think of routing like a restaurant's menu. When a customer (browser) asks for something (URL), the waiter (router) checks the menu (routes file), finds the right dish (controller action), and serves it. Without a proper menu, the waiter has no idea what to do with the order.
By the end of this article, you'll understand every routing concept Laravel offers — from basic GET routes to advanced route model binding. You'll write routes like a professional Laravel developer.
Where Do Routes Live in Laravel 13?
In Laravel 13 (and 11+), the routing architecture changed significantly from older versions. Routes are configured in bootstrap/app.php:
// bootstrap/app.php
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
api: __DIR__.'/../routes/api.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
// middleware configuration
})
->withExceptions(function (Exceptions $exceptions) {
// exception handling
})
->create();
Key change from Laravel 10 and earlier: There's no more RouteServiceProvider. Everything is configured in bootstrap/app.php using the fluent withRouting() method.
| Route File | Purpose | Middleware Group | URL Prefix |
|---|---|---|---|
routes/web.php | Browser-facing routes (HTML pages) | web (sessions, CSRF, cookies) | None (root) |
routes/api.php | API endpoints (JSON responses) | api (stateless, rate limited) | /api |
routes/console.php | Artisan command definitions | N/A | N/A |
Important: In Laravel 13,api.phpis NOT included by default. You must runphp artisan install:apito create it. This also installs Laravel Sanctum for token authentication.
Basic Routes — The Foundation
Every route maps a URL + HTTP method to a piece of code. Let's start with the simplest form:
Premium Content
Series-ன் full article-ஐ படிக்க Premium subscribe செய்யுங்கள்.
You've used 3 of 3 free articles today.
Subscribe NowAlready subscribed? Sign in




Comments (0)
Be the first to comment!