Kritim Yantra
Jul 04, 2025
You're working on a new Laravel project. You're excited, but the usual steps of setting up routes, controllers, and views start to feel like a chore. Wouldn't it be amazing if you could just create a file and boom β it's a page?
That's exactly what Laravel Folio offers.
In this blog post, you'll discover how Laravel Folio simplifies page-based routing, why it's a game-changer for beginners, and how you can use it in real-world projects with ease.
Laravel Folio is a new feature introduced in Laravel 12 that brings page-based routing to your application. Instead of manually defining routes and controllers, you just create Blade files inside a special folder, and Folio turns them into web pages automatically.
Think of it like how Next.js or Nuxt.js works β your file structure is your routing structure.
If you're new to Laravel, routing can feel overwhelming: routes/web.php
, controllers, method naming, and view connections. Folio removes that mental load.
This means less boilerplate, faster development, and more fun.
Make sure you're using Laravel 12, then install Folio via Composer:
composer require laravel/folio
php artisan folio:install
This will create a resources/views/pages
directory β the magic starts here.
Letβs say you want to make a greeting page:
Create this file:
resources/views/pages/greeting.blade.php
Add some HTML:
<h1>Hello, Laravel Folio!</h1>
Now visit /greeting
in your browser. It just works! β¨
Need to whip up a landing page for a campaign? Just drop a new .blade.php
file and you're done.
Use Folio to build a simple, organized static docs site with nested folders.
Quickly scaffold pages under pages/admin/...
and protect them with middleware (like auth
).
Folio even supports mounting routes on subdomains like fr.example.com
for multi-language sites.
Letβs build a dynamic user profile page.
Run this command:
php artisan folio:page "users/[id]"
This creates:
resources/views/pages/users/[id].blade.php
Inside it:
<h1>Welcome, user #{{ $id }}</h1>
Visit /users/42
and see the dynamic ID in action.
You can apply middleware like auth
to pages in two ways:
At the top of your Blade file:
<?php
use function Laravel\Folio\middleware;
middleware(['auth']);
?>
In routes/folio.php
:
Folio::path('resources/views/pages')->middleware([
'admin/*' => ['auth'],
]);
pages
directory.Basically, it's all the power of Laravel routing with none of the setup.
folio:list
to view all registered Folio routes.name('route.name')
for easy linking./admin/settings
.Benefit | Description |
---|---|
β Simplicity | No route/controller setup needed |
β‘ Speed | Launch pages in seconds |
β¨ Flexibility | Dynamic routing, middleware, subdomains |
π€ Beginner-friendly | Great learning curve and setup |
Laravel Folio helps you focus on building pages, not plumbing code.
If you're just getting started with Laravel or want to build fast, beautiful pages without the overhead, Folio is a fantastic tool.
Try creating a few pages in your next Laravel project and see how much faster your workflow becomes.
No comments yet. Be the first to comment!
Please log in to post a comment:
Sign in with Google