Folio Routing
When to Apply
Activate this skill when:
- Creating pages with file-based routing
- Working with route parameters and model binding
- Adding middleware to Folio pages
Documentation
Use search-docs for detailed Folio patterns and documentation.
Basic Usage
Laravel Folio is a file-based router that creates a new route for every Blade file within the configured directory.
Pages are usually in resources/views/pages/ and the file structure determines routes:
pages/index.blade.php → /
pages/profile/index.blade.php → /profile
pages/auth/login.blade.php → /auth/login
Listing Routes
You may list available Folio routes using php artisan folio:list or using the list-routes tool.
Creating Pages
Always create new folio pages and routes using php artisan folio:page [name] following existing naming conventions.
// Creates: resources/views/pages/products.blade.php → /products
{{ $assist->artisanCommand('folio:page "products"') }}
// Creates: resources/views/pages/products/[id].blade.php → /products/{id}
{{ $assist->artisanCommand('folio:page "products/[id]"') }}
Named Routes
Add a name at the top of each new Folio page to create a named route that other parts of the codebase can reference.
use function Laravel\Folio\name;
name('products.index');
Middleware
use function Laravel\Folio{name, middleware};
name('admin.products');
middleware(['auth', 'verified']);
Verification
- Run
php artisan folio:list to verify route registration
- Test page loads at expected URL
Common Pitfalls
- Forgetting to add named routes to new Folio pages
- Not following existing naming conventions when creating pages
- Creating routes manually in
routes/web.php instead of using Folio's file-based routing