Introduction
Lyger’s routing system provides a clean and expressive way to define your application’s routes. All routes are defined in theroutes/web.php file and support common HTTP methods through the Route facade.
Available HTTP Methods
The router supports all standard HTTP methods:Route Handlers
Routes can use either closures or controller methods as handlers.Closure Handlers
The simplest way to define a route is with a closure function:All route handlers receive the
Request object as the first parameter automatically.Controller Handlers
For better organization, you can reference controller methods using an array syntax:Request object:
Response Types
Lyger provides convenient methods for returning different response types:- JSON Response
- HTML Response
- Text Response
- Error Response
Auto-Response Formatting
If you return a non-Response value, the router will automatically format it:Status Codes and Headers
You can customize response status codes and headers:Loading Routes
Routes are automatically loaded from theroutes/web.php file when the application bootstraps:
Working with the Request Object
Every route handler receives theRequest object as the first parameter:
Next Steps
Route Parameters
Learn how to capture dynamic segments in your URLs
Middleware
Add middleware to filter and process requests