Download the PHP package lizzyman04/file-router-laravel without Composer
On this page you can find all versions of the php package lizzyman04/file-router-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lizzyman04/file-router-laravel
More information about lizzyman04/file-router-laravel
Files in lizzyman04/file-router-laravel
Package file-router-laravel
Short Description Laravel adapter for lizzyman04/file-router — Next.js-style file-based routing inside Laravel.
License MIT
Homepage https://github.com/lizzyman04/file-router-laravel
Informations about the package file-router-laravel
file-router-laravel
Laravel adapter for lizzyman04/file-router —
Next.js-style file-based routing inside a Laravel app. The directory
structure becomes the route table; routes are registered as native Laravel
routes, so they coexist with routes/web.php / routes/api.php and inherit
Laravel's middleware, container, and route caching.
Dispatch is fully deferred to Laravel's router — this package only resolves which file handles a URL.
Requirements
- PHP 8.2+
- Laravel 11 or 12
Install
Until the core
lizzyman04/file-routeris published on Packagist, add its repository to your app'scomposer.json:
Publish the config:
The service provider is auto-discovered.
Route files
Each route file returns a callable and declares its HTTP methods with a
// @methods header (defaults to GET):
Whatever the callable returns is handed to Laravel, which turns it into a
response (arrays → JSON, strings → HTML, Response/Responsable pass through).
Filesystem → URL
| File on disk | URL | Notes |
|---|---|---|
index.php |
/ |
|
about.php |
/about |
|
users/[id].php |
/users/{id} |
$params['id'] |
posts/[id]/comments.php |
/posts/{id}/comments |
|
files/[...path].php |
/files/{path} (catch-all, .*) |
$params['path'] is the rest of the URL |
(admin)/dashboard.php |
/dashboard |
group folder stripped |
Matching is specificity-ordered: static > dynamic > catch-all.
Middleware & coexistence
- Middleware from the config is applied to every file-based route (they run through Laravel's normal pipeline).
- File-based routes are added to Laravel's route collection on boot, so they
live alongside your
routes/web.phpandroutes/api.phproutes. - Unmatched methods/paths produce Laravel's own 405/404 responses.
Testing
Tests run against a real Laravel app via orchestra/testbench.
License
MIT
All versions of file-router-laravel with dependencies
lizzyman04/file-router Version ^1.0
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/routing Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0