Download the PHP package asker/rocket-router without Composer
On this page you can find all versions of the php package asker/rocket-router. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download asker/rocket-router
More information about asker/rocket-router
Files in asker/rocket-router
Download asker/rocket-router
More information about asker/rocket-router
Files in asker/rocket-router
Vendor asker
Package rocket-router
Short Description A fast and flexible PHP router package with attribute-based routing and automatic route generation
License MIT
Homepage https://github.com/asker26/rocket-router
Package rocket-router
Short Description A fast and flexible PHP router package with attribute-based routing and automatic route generation
License MIT
Homepage https://github.com/asker26/rocket-router
Please rate this library. Is it a good library?
Informations about the package rocket-router
RocketRouter
A framework-agnostic PHP library for attribute-based routing. Scans controller classes at build time, generates a cache with zero runtime reflection.
Installation
Features
- Attribute-based routing using PHP 8+ attributes
- Framework-agnostic — works with WordPress, Laravel, or any PHP framework
- Zero runtime reflection — all scanning happens at build time
- OPcache-friendly — routes are cached as a native PHP file
- Parameter binding via
#[FromRoute],#[FromBody],#[FromQuery]
Usage
1. Define Controllers
2. Generate Route Cache
Run at build/deploy time:
This scans your controllers, resolves all attributes, and writes a cache file. No reflection needed at runtime.
3. Load Routes at Runtime
4. Register with a Framework
Implement RouteRegistrarInterface for your framework, or use the built-in WordPress adapter:
5. Available Attributes
| Attribute | Target | Description |
|---|---|---|
#[ApiController] |
Class | Mark a class as a scannable controller |
#[Route('/path')] |
Class | Define a route prefix |
#[RouteGet('/path')] |
Method | GET route |
#[RoutePost('/path')] |
Method | POST route |
#[RoutePut('/path')] |
Method | PUT route |
#[RouteDelete('/path')] |
Method | DELETE route |
#[FromRoute('name')] |
Parameter | Bind from route path parameter |
#[FromBody] |
Parameter | Bind from request JSON body |
#[FromQuery] |
Parameter | Bind from query string |
Writing a Custom Adapter
Implement RouteRegistrarInterface and ParameterResolverInterface:
Requirements
- PHP 8.0 or higher
License
MIT License. See LICENSE file for details.
All versions of rocket-router with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.0
The package asker/rocket-router contains the following files
Loading the files please wait ...