PHPackages                             open-core/router - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. open-core/router

ActiveLibrary[HTTP &amp; Networking](/categories/http)

open-core/router
================

PSR-15 compliant fast Router Middleware based on precompiled searching tree

1.0.1(3y ago)1133↑50%MITPHPPHP &gt;=8.1CI passing

Since Apr 15Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/idashevskii/open-core-router)[ Packagist](https://packagist.org/packages/open-core/router)[ RSS](/packages/open-core-router/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (3)Used By (0)

PSR-15 compliant fast Router Middleware based on precompiled searching tree.

Features
--------

[](#features)

- PSR-7, PSR-11, PSR-15, PSR-17 compliant.
- Controllers with attribute-based (annotations) routing.
- Passing parsed request body as param to controller method.
- Passing PSR request/response objects to controller method.
- Optional controller method params resolved as URL Query params.
- Params and body type casting according handler method signature.
- Router compile advantages:
    - No need to load all controller classes every time.
    - Because of pre-compiled tree structure, the complexity of matching algorithm is O(log n) instead of O(n).
- Almost no regex matches.
- Reverse routing.
- Fully configurable data deserialization.

Lifecycle
---------

[](#lifecycle)

One-time compilation:

- Looking for all Controller and its method according to routes.
- Executing RouteAnnotations to resolve extra Route attributes.
- Building and caching route tree.
- Building and caching data for reverse routing.

Runtime phase 1 (assumption):

- Creating PSR-7 `ServerRequest` object.

Runtime phase 2:

- Resolving Controller, method and attributes for PSR-7 `ServerRequest`.
- Modifying request by attaching custom attributes and data required to run controller.

Runtime phase 3 (assumption):

- Running other middlewares, which can be enabled/disabled based on PSR-7 `ServerRequest` attributes. Example: Authorization or CSFR can be disabled for specific routes.

Runtime phase 4:

- Reading the attributes from PSR-7 `ServerRequest`.
- Running controller with method resolved on Phase 2.
- If controller returned data in simplified form, wrapping it into final response.

Why there is two middlewares for routing?
-----------------------------------------

[](#why-there-is-two-middlewares-for-routing)

The main reason is to use annotations (PHP Attributes) to configure other middlewares using Request attributes. For example, this allows to set `AuthMiddleware` in between, so it could reject request before it will be handled by `Controller`.

RouteAnnotations
----------------

[](#routeannotations)

`RouteAnnotations` is kind of syntax sugar. The same effect can be reached by `Route` `$attributes` parameter. Because route attributes are resolved before route tree is cache, it should not to be dynamic.

Special handler method arguments
--------------------------------

[](#special-handler-method-arguments)

There is ability to pass Request or even parsed body directly to route handler:

- If type of handler method parameter is `ServerRequestInterface`, it will be resolved as raw $request.
- If type of handler method parameter is `ResponseInterface`, it will be resolved as new $response. So no need to call `ResponseFactoryInterface`
- If parameter is annotated by `Body` attribute, it will be resolved by `body` property of request. Also it could be parsed as JSON if its type is `array`.

Reverse Router
--------------

[](#reverse-router)

The route path can be generated by route name and params.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance59

Moderate activity, may be stable

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

1129d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d83615d99e4e14a999e5372e4a352954ff4843f6ee071f741ce53bb7c845daae?d=identicon)[idashevskii](/maintainers/idashevskii)

---

Top Contributors

[![idashevskii](https://avatars.githubusercontent.com/u/2737339?v=4)](https://github.com/idashevskii "idashevskii (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/open-core-router/health.svg)

```
[![Health](https://phpackages.com/badges/open-core-router/health.svg)](https://phpackages.com/packages/open-core-router)
```

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k63.6M233](/packages/nelmio-api-doc-bundle)[neos/flow

Flow Application Framework

862.0M451](/packages/neos-flow)[neos/flow-development-collection

Flow packages in a joined repository for pull requests.

144179.3k3](/packages/neos-flow-development-collection)[windwalker/framework

The next generation PHP framework.

25639.1k1](/packages/windwalker-framework)[jaxon-php/jaxon-core

Jaxon is an open source PHP library for easily creating Ajax web applications

73142.3k25](/packages/jaxon-php-jaxon-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
