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

ActiveLibrary[Framework](/categories/framework)

yiiboot/routing
===============

the yii3 attribute routing

v1.0.0(3y ago)02[4 PRs](https://github.com/yiiboot/routing/pulls)Apache-2.0PHPPHP ^8.1

Since Nov 27Pushed 3y ago1 watchersCompare

[ Source](https://github.com/yiiboot/routing)[ Packagist](https://packagist.org/packages/yiiboot/routing)[ Docs](https://github.com/yiiboot)[ GitHub Sponsors](https://github.com/sponsors/yiiboot)[ OpenCollective](https://opencollective.com/yiiboot)[ RSS](/packages/yiiboot-routing/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (11)Versions (6)Used By (0)

 [ ![](https://avatars.githubusercontent.com/u/118281946?s=600&u=b16475d97095b69a8f500ec2f29b8d05c3d02b3a&v=4) ](https://github.com/yiiboot)

YiiBoot Routing
===============

[](#yiiboot-routing)

An way to define an route with the Route PHP attribute. This allows to configure the route inside its class, without having to add any configuration in external files

Requirements
------------

[](#requirements)

- PHP 8.1 or higher.

Installation
------------

[](#installation)

The package could be installed with composer:

```
composer require yiiboot/routing
```

General usage
-------------

[](#general-usage)

the `config/params.php`

```
return [
    // ...
    'yiiboot/attributed' => [
        'paths' => [
            dirname(__DIR__) . '/src/Controller'
        ]
    ]
];
```

the `src/Controller/CustomController.php`

```
namespace App\Controller;

use Yiiboot\Routing\Attribute\Route;use Yiisoft\Router\CurrentRoute;

#[Route('/customs', name:'customs.', middleware: [
    FormatDataResponseAsJson::class
])]
final class CustomController
{
    #[Route('/{page:\d+}', name: 'list', method: 'GET', defaults: ['page' => 1])]
    public function list(): ResponseInterface
    {
        // ...
    }

    #[Route('/{id:\d+}', name: 'view', method: 'GET')]
    public function view(CurrentRoute $route): ResponseInterface
    {
        $id = $route->getArgument('id');
        // ...
    }

    #[Route(name: 'create', method: 'POST')]
    public function create(): ResponseInterface
    {
        // ...
    }

    #[Route('/{id:\d+}', name: 'delete', method: 'DELETE')]
    public function delete(CurrentRoute $route): ResponseInterface
    {
        $id = $route->getArgument('id');
        // ...
    }
}
```

Testing
-------

[](#testing)

### Unit testing

[](#unit-testing)

The package is tested with [PHPUnit](https://phpunit.de/). To run tests:

```
./vendor/bin/phpunit
```

### Mutation testing

[](#mutation-testing)

The package tests are checked with [Infection](https://infection.github.io/) mutation framework with [Infection Static Analysis Plugin](https://github.com/Roave/infection-static-analysis-plugin). To run it:

```
./vendor/bin/roave-infection-static-analysis-plugin
```

### Static analysis

[](#static-analysis)

The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis:

```
./vendor/bin/psalm
```

### Code style

[](#code-style)

Use [Rector](https://github.com/rectorphp/rector) to make codebase follow some specific rules or use either newest or any specific version of PHP:

```
./vendor/bin/rector
```

### Dependencies

[](#dependencies)

Use [ComposerRequireChecker](https://github.com/maglnet/ComposerRequireChecker) to detect transitive [Composer](https://getcomposer.org/) dependencies.

License
-------

[](#license)

The Yii Routing is free software. It is released under the terms of the Apache-2.0 License. Please see [`LICENSE`](./LICENSE.md) for more information.

Maintained by [Yii Boot](https://github.com/yiiboot).

Support the project
-------------------

[](#support-the-project)

[![Open Collective](https://camo.githubusercontent.com/a2b15f8e2268d4e3842e00d41ff7a57cce2ad8bd8d8769c5dc4fa05a546a4f62/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4f70656e253230436f6c6c6563746976652d73706f6e736f722d3765616466313f6c6f676f3d6f70656e253230636f6c6c656374697665266c6f676f436f6c6f723d376561646631266c6162656c436f6c6f723d353535353535)](https://opencollective.com/yiiboot)

Follow updates
--------------

[](#follow-updates)

[![Official website](https://camo.githubusercontent.com/ce0c1f0b71b0a3b66dd8170c51392171c5edc688e7570ecada6e19a0b4d02a03/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f77657265645f62792d5969695f426f6f742d677265656e2e7376673f7374796c653d666c6174)](https://www.yiiframework.com/)

Inspired &amp;&amp; Thanks
--------------------------

[](#inspired--thanks)

- [Yii Software](https://github.com/yiisoft)
- [Yii Stack](https://github.com/yiistack)
- [Symfony](https://github.com/symfony/symfony)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

1268d ago

### Community

Maintainers

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

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/yiiboot-routing/health.svg)

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

###  Alternatives

[yiisoft/yii-middleware

Yii Middleware

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

Yii3 web application template

35512.3k](/packages/yiisoft-app)[yiisoft/app-api

Yii3 API project template

971.5k](/packages/yiisoft-app-api)[yiisoft/router-fastroute

Yii router FastRoute adapter

41301.0k14](/packages/yiisoft-router-fastroute)[yiisoft/router

Yii router

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

Yii data displaying widgets

4252.6k1](/packages/yiisoft-yii-dataview)

PHPackages © 2026

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