Download the PHP package php-compatible/router without Composer
On this page you can find all versions of the php package php-compatible/router. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download php-compatible/router
More information about php-compatible/router
Files in php-compatible/router
Package router
Short Description PHP 8-style routing for PHP 4+ - Modern routing API that works on legacy PHP
License MIT
Informations about the package router
PHP Compatible Router
Modern routing for legacy PHP applications — Write clean routes today, upgrade to modern frameworks tomorrow.
The Problem
You're maintaining a PHP application that's been around for years. Maybe it started on PHP 4 or 5. The codebase works, but:
- Routes are scattered across dozens of files with mixed HTTP verbs
.htaccessrewrites have become impossible to follow- You want to modernize, but a full framework migration isn't feasible right now
- Your team needs to support multiple PHP versions during the transition
The Solution
This router meets you where you are. Whether you're on PHP 5.5 or PHP 8.5, you get the same clean, expressive API. No conditional syntax, no version-specific features — just routing that works.
Your Upgrade Journey
This router supports developers at every stage of modernization:
Stage 1: Legacy Cleanup (PHP 5.5+)
You have working code but messy routing. Drop in this router to consolidate scattered route definitions without changing your PHP version.
Stage 2: Adding Structure (PHP 7.0+)
Ready for more organization? Group related routes and add middleware.
Stage 3: Modern Patterns (PHP 7.4+)
Adopt PSR-7 style request/response objects while maintaining backward compatibility.
Stage 4: Framework Ready (PHP 8.0+)
When you're ready to migrate to Laravel, Symfony, or another framework, your route definitions are already clean and portable. The patterns you've learned transfer directly.
Installation
Features
HTTP Methods
URL Parameters
Route Groups
Middleware
Response Helpers
PSR-7 Style Classes
HTTP Status Constants
All standard HTTP status codes are available as constants:
HTTP Exceptions
Handler Types
The router accepts multiple handler types:
Apache Configuration
Add to your .htaccess:
Nginx Configuration
Why Not Just Use Laravel/Symfony?
You should! Eventually. But if you're maintaining a legacy application:
- Framework migrations take time — This router lets you clean up routing now
- Team skills vary — Simple function-based routing has a gentle learning curve
- Incremental improvement — Modernize piece by piece instead of big-bang rewrites
- Version constraints — Not everyone can run PHP 8.1+ in production yet
This router is a stepping stone, not a destination. Use it to bring order to chaos, then migrate to a full framework when you're ready.
Requirements
- PHP 5.5 or higher (tested through PHP 8.5)
- Apache with mod_rewrite or Nginx
Testing
License
MIT License. See LICENSE for details.