Route
For the how-and-why — groups, middleware order, the 404-vs-405 distinction — see Routing. This page is the full method reference.
Registration
Route::get(string $uri, callable|array $action): Route
Route::post(string $uri, callable|array $action): Route
Route::put(string $uri, callable|array $action): Route
Route::patch(string $uri, callable|array $action): Route
Route::delete(string $uri, callable|array $action): Route
Route::options(string $uri, callable|array $action): Route
Route::fallback(callable|array $action): void
Chained modifiers
->name(string $name): self
->middleware(string|callable|array $middleware): self
->where(string $parameter, string $pattern): self
Groups
Route::group(array $attributes, callable $callback): void
// $attributes: ['prefix' => string, 'middleware' => string|callable|list<string|callable>]
Parameter syntax
| Syntax | Matches |
|---|---|
{id} | any non-slash segment |
{id:int} | \d+ |
{slug:alpha} | [A-Za-z]+ |
{id:uuid} | a UUID |
{id?}, {id:int?} | optional (trailing ?) |
Dispatch and lifecycle
Route::dispatch(Request $request): Response
Route::reset(): void // clears all routes, groups, and fallback — test isolation