Skip to main content

Router

CI codecov PHP Version License

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. The codebase works, but:

  • Routes are scattered across dozens of files with mixed HTTP verbs
  • .htaccess rewrites 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.

Features​

  • PHP 5.5 - 8.5 Compatible — Same API across all versions
  • File-Based Routing — Drop-in routing for existing PHP file structures
  • Route Groups — Organize routes with common prefixes
  • Middleware Support — Add authentication, logging, etc.
  • PSR-7 Style Objects — Optional request/response classes
  • HTTP Exceptions — HttpException::notFound() factory methods
  • 98% Test Coverage — Thoroughly tested across all PHP versions

Routing Approaches​

ApproachBest ForStyle
File-Based RoutingLegacy projects with existing PHP filesfile_router() in each file
Functional RoutingFull control, centralized routesrouter(), route(), url_path()
Modern RoutingClean syntax, new projectsRouter::get(), Router::post()