PHPackages                             alexpts/php-psr15-routing - 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. alexpts/php-psr15-routing

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

alexpts/php-psr15-routing
=========================

Middleware routing compatible with the PSR-7 and PSR-15

2.1.0(8y ago)047[2 issues](https://github.com/alexpts/php-psr15-routing/issues)MITPHPPHP ~7.2

Since Mar 25Pushed 7y ago1 watchersCompare

[ Source](https://github.com/alexpts/php-psr15-routing)[ Packagist](https://packagist.org/packages/alexpts/php-psr15-routing)[ Docs](https://github.com/alexpts/php-psr15-routing)[ RSS](/packages/alexpts-php-psr15-routing/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (6)Dependencies (4)Versions (7)Used By (0)

psr-15 routing
==============

[](#psr-15-routing)

[![Build Status](https://camo.githubusercontent.com/d36ee3653dceffcc546ad312fd5db3bed93b0e1a139c1225f8a13175aa31a368/68747470733a2f2f7472617669732d63692e6f72672f616c65787074732f7068702d70737231352d726f7574696e672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/alexpts/php-psr15-routing)[![Code Coverage](https://camo.githubusercontent.com/ab64e43e70c51a6d7b9107590c187f4f2951da8880cebd054637695641ecab5c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616c65787074732f7068702d70737231352d726f7574696e672f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/alexpts/php-psr15-routing/?branch=master)[![Code Climate](https://camo.githubusercontent.com/487a8c04b2a4e07bebbb3fb330b961a5614f1a6f51b61c0cbd0eedd47589de5e/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f616c65787074732f7068702d70737231352d726f7574696e672f6261646765732f6770612e737667)](https://codeclimate.com/github/alexpts/php-psr15-routing)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e9cc7d838629a916dab46a890c411b3f8681005970443b56c93d7b306c438429/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616c65787074732f7068702d70737231352d726f7574696e672f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/alexpts/php-psr15-routing/?branch=master)

#### Install

[](#install)

`composer require alexpts/php-psr15-routing`

Простой роутер с поддержкой PSR-7, PSR-15

#### Возможности

[](#возможности)

- Простой захват параметров из url
- Использование RegExp для описания роута
- Гибкие группировки для захвата параметров
- Приоритеты роутов
- Высокая скорость работы

### Example

[](#example)

```
use PTS\PSR15Routing\CallableAdapter;
use PTS\PSR15Routing\Router;
use PTS\PSR15Routing\Route;
use PTS\PSR15Routing\RouterMiddleware;

$router = new Router;

$router->add('/', new Route('/', new CallableAdapter(function($request) {
    return $response; // $response must be ResponseInterface
})));

$handler = ...; // $handler bust be RequestHandlerInterface
$router->add('/admin', new Route('/', $handler));

// with priority
$router->add('/admin/1', new Route('/', $handler), 100);

// some middleware manager/runner
$app = (new MiddlewareManager)
	->push(new RouterMiddleware($router);

$response = $app->handler($request);
```

### EndPoint (bonus)

[](#endpoint-bonus)

EndPoint is wrapper for real handler route. It need for flex config real handler and get real handler from runtime.

```
use PTS\PSR15Routing\CallableAdapter;
use PTS\PSR15Routing\Router;
use PTS\PSR15Routing\Route;
use PTS\PSR15Routing\RouterMiddleware;
use PTS\EndPoint\DynamicPoint;
use PTS\EndPoint\EndPoint;

$router = new Router;

$flexHandler = new DynamicPoint([
	'prefix' => '\\Namespace\\ForDynamicController\\'
]);
$router->add('flex', new Route('/{_controller}/{_action}/', $flexHandler));
// /blog/get/ => \\Namespace\\ForDynamicController\\Blog::get()

$mainPageHandler = new EndPoint(['controller' => SomeController::class]);
$router->add('mainPage', new Route('/', $mainPageHandler)); // SomeController::index()

// with params from url
$postHandler = new DynamicPoint([
	'controller' => '\\Project\\PostController',
]);
$router->add('posts', new Route('/posts/{_action}/{id}/', $postHandler));
// /posts/get/4/ => PostController::get($id = 4)
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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 ~8 days

Total

6

Last Release

2926d ago

Major Versions

1.1.0 → 2.0.02018-05-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/31106536118e11bf9d0c9d7f467db5b534efa9c46ee76680b308f0c39d9a798c?d=identicon)[alexpts](/maintainers/alexpts)

---

Top Contributors

[![alexpts](https://avatars.githubusercontent.com/u/1306916?v=4)](https://github.com/alexpts "alexpts (22 commits)")

---

Tags

psr-7middlewarerouterroutingpsr-15

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/alexpts-php-psr15-routing/health.svg)

```
[![Health](https://phpackages.com/badges/alexpts-php-psr15-routing/health.svg)](https://phpackages.com/packages/alexpts-php-psr15-routing)
```

###  Alternatives

[mezzio/mezzio-authentication

Authentication middleware for Mezzio and PSR-7 applications

121.6M26](/packages/mezzio-mezzio-authentication)[middlewares/fast-route

Middleware to use FastRoute

96191.1k15](/packages/middlewares-fast-route)[jimtools/jwt-auth

PSR-15 JWT Authentication middleware, A replacement for tuupola/slim-jwt-auth

20142.3k3](/packages/jimtools-jwt-auth)[middlewares/aura-router

Middleware to use Aura.Router

1110.9k3](/packages/middlewares-aura-router)

PHPackages © 2026

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