Download the PHP package yeremi/route-mapper without Composer
On this page you can find all versions of the php package yeremi/route-mapper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yeremi/route-mapper
More information about yeremi/route-mapper
Files in yeremi/route-mapper
Package route-mapper
Short Description A PHP library for mapping and resolving routes using attributes.
License MIT
Informations about the package route-mapper
RouteMapper
RouteMapper is a lightweight, framework-agnostic PHP library that uses PHP 8 attributes to map and resolve API route paths defined via PHP attributes in a simple and explicit way.
It focuses on one responsibility only: mapping routes to methods, without imposing an HTTP framework or execution model.
Design Philosophy
- RouteMapper focuses on one responsibility only: mapping routes to methods.
- It does not handle HTTP requests, middleware, controllers, or responses.
- Integration is explicit by design — no magic containers or hidden behavior.
- The library favors clarity over convenience.
- If you need a full routing framework, RouteMapper is probably not the right tool.
Key Features
- Attribute-Based Routing using PHP 8 attributes
- Framework-Agnostic (works with any HTTP client or framework)
- Lightweight & Focused — no unnecessary abstractions
- Explicit Route Resolution — no magic, full control
- Modern PHP — strict typing and PHP 8 features
Requirements
- PHP 8.0 or higher
Why Use RouteMapper?
Use RouteMapper when you want to keep routing metadata close to your code (via attributes) and still remain framework-agnostic. It works well for SDKs, API clients, small services, and projects that want explicit, testable route resolution without adopting a full stack.
Installation
Install RouteMapper via Composer:
Example Usage
Routes are resolved using the class name and method name.
Defining routes with attributes
Note: RouteMapper does not perform HTTP requests. Any HTTP client (Guzzle, Symfony HttpClient, etc.) can be used.
Comparison with Other Solutions
| Feature | RouteMapper | Symfony Routing | Laravel Routing | Slim Framework |
|---|---|---|---|---|
| Attribute-based | ✅ | ✅ | ❌ | ❌ |
| Framework-Agnostic | ✅ | ❌ | ❌ | ✅ |
| Lightweight | ✅ | ⚠️ | ❌ | ✅ |
| Explicit resolution | ✅ | ❌ | ❌ | ⚠️ |
Acknowledgments
Inspired by the flexibility of modern PHP attributes and the simplicity of middleware-based frameworks.
License
RouteMapper is licensed under the MIT License. See the LICENSE file for details.