Download the PHP package veloxrouter/router without Composer
On this page you can find all versions of the php package veloxrouter/router. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download veloxrouter/router
More information about veloxrouter/router
Files in veloxrouter/router
Package router
Short Description Lightning-fast HTTP routing engine for PHP
License MIT
Informations about the package router
VeloxRouter - Router Package
A lightning-fast, lightweight HTTP routing engine built for modern PHP 8.2+.
🔗 Access the Official Documentation
🚀 About
veloxrouter/router is the core routing engine of the VeloxRouter ecosystem. Inspired by high-performance frameworks like Go Fiber and Python FastAPI, it is designed for maximum speed, clean architecture, and zero unnecessary bloat.
📦 Installation
Install the package via Composer:
🌐 Server Configuration (Apache / .htaccess)
To ensure that all incoming HTTP requests are properly handled by your application, point your web server document root to the public/ directory and use the following configuration setup:
1. public/index.php (Front Controller)
Create your main entry point inside the public/ folder:
2. public/.htaccess (URL Rewriting for Apache)
Place this .htaccess file inside your public/ directory to enable clean URLs:
(Note: For local testing and development, you can also let VeloxRouter automatically spin up PHP's built-in development server by calling $router->run() via CLI).
⚙️ Usage Example
Here is a practical example demonstrating how to set up routes handling different HTTP verbs (GET, POST, PUT, DELETE), dynamic path parameters, and strict regex validation:
📊 Benchmark Performance
VeloxRouter uses a dual-storage strategy (an $O(1)$ hash dictionary for static routes and an optimized regex engine for dynamic routes), ensuring maximum throughput and zero extra memory allocation at peak loads.
Results obtained from a simulated enterprise environment containing hundreds of registered routes:
| Test Scenario | Iterations | Average per Exec | Throughput (Ops/sec) | Memory (Peak) |
|---|---|---|---|---|
| Static Route Match | 50,000 | 1.43 µs | ~698,529 ops/s | 0.00 KB |
Typed Parameter Match (/users/42) |
20,000 | 14.65 µs | ~68,251 ops/s | 0.00 KB |
| Complex Dynamic Route Match | 20,000 | 13.95 µs | ~71,707 ops/s | 0.00 KB |
| Named Route URL Generation | 50,000 | 2.82 µs | ~354,977 ops/s | 0.00 KB |
| Not Found Match (404 / Large Table) | 20,000 | 13.16 µs | ~75,984 ops/s | 0.00 KB |
📄 License
The VeloxRouter package is open-sourced software licensed under the MIT license.