Download the PHP package jdz/router without Composer
On this page you can find all versions of the php package jdz/router. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package router
Short Description JDZ Router is a PHP routing library built on top of the Symfony Routing component.
License MIT
Homepage https://jdz.joffreydemetz.com/router
Informations about the package router
JDZ Router
Router is a PHP routing library built on top of the Symfony Routing component. It provides a clean and intuitive API for managing routes, generating URLs, and handling HTTP requests in your web applications.
Features
- Built on the Symfony Routing component for robust routing capabilities.
- Generate routes programmatically and export to YAML format.
- Load routes from YAML files with support for multiple file sources.
- Route matching with automatic request parameter parsing.
- URL generation for named routes (relative and absolute).
- Redirect path management for legacy URL handling.
- Support for JSON endpoints with automatic format detection.
- HTTP method constraints (GET, POST, etc.).
- Route parameter requirements and defaults.
- Immutable route collections for read-only configurations.
- Type-safe with PHP 8.2+ features.
Installation
Add the package to your project using Composer:
Requirements
- PHP 8.2 or higher
- symfony/config
- symfony/http-foundation
- symfony/routing
- symfony/string
- symfony/yaml (for YAML support)
Usage
For a complete example, check the examples folder in the repository.
Basic Router Setup
Generating Routes
Export Routes to YAML
Example YAML output:
Route Matching
URL Generation
Loading Routes into Application
Redirect Management
JSON Routes
HTTP Method Constraints
Route Options
Immutable Routes
Testing
The package includes a comprehensive test suite with 100 tests covering all functionality.
To run the tests:
Or directly with PHPUnit:
License
This project is licensed under the MIT License - see the LICENSE file for details.
All versions of router with dependencies
symfony/config Version ^7.4
symfony/http-foundation Version ^7.4
symfony/routing Version ^7.4
symfony/string Version ^7.4