Download the PHP package denosyscore/routing without Composer
On this page you can find all versions of the php package denosyscore/routing. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download denosyscore/routing
More information about denosyscore/routing
Files in denosyscore/routing
Package routing
Short Description DenosysCore: Fast PSR-7 Router and Dispatcher PHP package with PSR-15 Middleware support
License MIT
Homepage https://github.com/denosyscore/routing
Informations about the package routing
Denosys Routing
A highly efficient and flexible routing package for PHP, designed to support modern web applications with minimal overhead.
Features
- Fast Route Matching: Utilizes a trie data structure for efficient route matching.
- Flexible Handlers: Supports various types of handlers (closures, arrays, strings).
- PSR-7/PSR-15 Compliant: Compatible with PSR-7 HTTP messages and PSR-15 middleware.
- Global Middleware: Application-wide middleware via
$router->use(). - Middleware Groups & Aliases: Reusable middleware configurations with named groups.
- Customizable Invocation Strategies: Define how route handlers are invoked.
- Dependency Injection: Integrates with PSR-11 containers for automatic dependency resolution.
- Dynamic and Static Routes: Easily define and handle both dynamic and static routes.
- Attribute-Based Routing: Define routes using PHP 8 attributes on controller methods.
Requirements
- PHP 8.2 or later
Usage
Install the package using Composer:
Install a PSR-7 implementation, such as Laminas Diactoros:
Here's a simple example of how to define routes and handle requests:
Middleware
The Router supports PSR-15 middleware with built-in execution via the Dispatcher.
Global Middleware
Use $router->use() to register middleware that runs on every request:
Global middleware:
- Executes before any route-specific middleware (outermost layer)
- Applied at dispatch time, so order of
use()vs route definitions doesn't matter - Supports class strings, aliases, or middleware instances
Route Middleware
Add middleware to specific routes:
Middleware Groups and Aliases
Register reusable middleware configurations:
Route Groups with Middleware
Apply middleware to all routes in a group:
Excluding Middleware
Use withoutMiddleware() to exclude specific middleware from a route:
Retrieving Middleware Metadata
Adding Routes
You can add routes using various HTTP methods:
Full documentation coming soon...
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.
All versions of routing with dependencies
psr/container Version ^2.0
psr/http-factory Version ^1.1
psr/http-message Version ^2.0
psr/http-server-handler Version ^1.0
psr/http-server-middleware Version ^1.0