PHPackages                             poa/httprouter - 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. [Framework](/categories/framework)
4. /
5. poa/httprouter

ActiveLibrary[Framework](/categories/framework)

poa/httprouter
==============

基于POA洋葱圈模型的路由器中间件，通过实现路由规则来定制路由器具体的动作

0.1.0(4y ago)04MITPHPPHP &gt;=7.4

Since Oct 24Pushed 4y ago1 watchersCompare

[ Source](https://github.com/york8/poa-httprouter)[ Packagist](https://packagist.org/packages/poa/httprouter)[ RSS](/packages/poa-httprouter/feed)WikiDiscussions master Synced today

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

poa-httprouter
==============

[](#poa-httprouter)

[![Latest Version on Packagist](https://camo.githubusercontent.com/adc04441d068984343cbfaf315d361a8c2b1402aab8ce75c4490a4744d489547/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706f612f68747470726f757465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/poa/httprouter)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Total Downloads](https://camo.githubusercontent.com/db3a62cd0ff213de8f04c00617165cb492233e208cb6407090d3d403c9a99538/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706f612f68747470726f757465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/poa/httprouter)

基于POA洋葱圈模型的路由器中间件，通过实现路由规则来定制路由器具体的动作

作者
--

[](#作者)

- [York](https://github.com/york8)

安装
--

[](#安装)

```
{
  "require": {
    "poa/httprouter": "~0.1"
  }
}
```

```
composer update
```

或

```
composer install poa/httprouter
```

示例
--

[](#示例)

```
use Poa\Http\Router\CallableResult;
use Poa\Http\Router\Router;
use Poa\Http\Router\RouteResultInterface;
use Poa\Http\Router\RouteRulerInterface;
use Poa\Http\Server\HttpApplication;
use Poa\Http\Server\HttpContext;

class SimpleRuler implements RouteRulerInterface
{
    public function process(HttpContext $context): ?RouteResultInterface
    {
        if ($context->request->getMethod() === 'get') {
            return new CallableResult(function () {
                echo 'do something';
            });
        }
        return null;
    }
}

$router = new Router();
$router->addRuler(new SimpleRuler());

$app = new HttpApplication();
$app->use($router);

$app->handle(new HttpContext($request, $responst));
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

1658d ago

### Community

Maintainers

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

---

Tags

middlewareframeworkroutergeneratorpoa

### Embed Badge

![Health badge](/badges/poa-httprouter/health.svg)

```
[![Health](https://phpackages.com/badges/poa-httprouter/health.svg)](https://phpackages.com/packages/poa-httprouter)
```

###  Alternatives

[slim/slim

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

12.2k49.9M1.3k](/packages/slim-slim)[davidepastore/slim-validation

A slim middleware for validation based on Respect/Validation

171223.7k3](/packages/davidepastore-slim-validation)[yiisoft/router

Yii router

62321.8k21](/packages/yiisoft-router)[yiisoft/yii-middleware

Yii Middleware

21151.3k1](/packages/yiisoft-yii-middleware)

PHPackages © 2026

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