Laravel Folio: File-Based Routing for Blade Applications

Laravel Folio: File-Based Routing for Blade Applications

Laravel Folio: File-Based Routing for Blade Applications

Laravel Folio is a page-based router for Laravel that maps Blade files in a resources/views/pages directory directly to application routes — no more manually registering routes in web.php for simple pages.

How It Works

resources/views/pages/about.blade.php        →  /about
resources/views/pages/users/[id].blade.php  →  /users/{id}

Installation

composer require laravel/folio
php artisan folio:install

Middleware and Route Model Binding

Folio pages support middleware via the middleware() function at the top of any Blade file, and route model binding works automatically when parameter names match Eloquent model names.

<?php
use function Laravel\Folio\{middleware, name};
middleware(['auth', 'verified']);
name('dashboard');
?>
<x-layouts.app>
    Welcome to your dashboard.
</x-layouts.app>
All Comments