Download the PHP package franco2911/avrestirouter without Composer
On this page you can find all versions of the php package franco2911/avrestirouter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download franco2911/avrestirouter
More information about franco2911/avrestirouter
Files in franco2911/avrestirouter
Informations about the package avrestirouter
AvrestiRouter
AvrestiRouter is a simple yet powerful PHP routing library inspired by Laravel. It provides an easy-to-use API for defining and resolving routes, handling different HTTP methods, and managing route groups with named parameters.
Features
- Support for all HTTP methods (GET, POST, PUT, PATCH, DELETE)
- Named route parameters for dynamic routing
- Grouped routes for better organization
- Custom regex patterns for route parameters
Requirements
- PHP >= 8.3
Installation
You can install AvrestiRouter using Composer:
Getting Started
Initialize AvrestiRouter
First, initialize the AvrestiRouter
and set it using the Route
facade:
Defining Routes
You can define routes using the Route
facade. Below are examples for various route definitions:
Basic Route
Named Route
Grouped Routes
Resolving Routes
To resolve the current route based on the incoming request, use the resolve
method. You can create a ServerRequest
instance using Guzzle:
Generating URLs from Route Names
You can generate URLs for named routes using the generateUrl
method:
Example Usage
You can find a complete example demonstrating the usage of AvrestiRouter in the example directory.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions
Contributions are welcome! Please fork this repository and submit pull requests to contribute improvements or new features.