PHPackages                             aweitian/route - 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. aweitian/route

ActiveProject

aweitian/route
==============

常用 路由

3.0.5(6y ago)0193MITPHPPHP &gt;=5.3.0CI failing

Since Jul 4Pushed 6y ago1 watchersCompare

[ Source](https://github.com/aweitian/route)[ Packagist](https://packagist.org/packages/aweitian/route)[ Docs](https://github.com/aweitian/route)[ RSS](/packages/aweitian-route/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (26)Used By (0)

路由第三版
=====

[](#路由第三版)

[![Image text](https://raw.githubusercontent.com/aweitian/route/master/md.png)](https://raw.githubusercontent.com/aweitian/route/master/md.png)

安装组件
----

[](#安装组件)

使用 composer 命令进行安装或下载源代码使用。

> composer require aweitian/route

生命周期
----

[](#生命周期)

1. 匹配
2. 派遣检测
3. 中间件
4. 派遣调用

匹配
--

[](#匹配)

- 函数
- 相等
- 请求方式
- 正则
- 组合

派遣
--

[](#派遣)

- 命名空间\\类@方法
- 回调函数(request,matches,detect),

> 当函数参数小于3个时,会被封闭,添加成三个参数,并添加检测为TRUE 当函数参数等于3个时,自己写DETECT逻辑

路由
--

[](#路由)

- 命名空间\\类@方法
- 回调函数

路由器
---

[](#路由器)

- ca($middleware = array(), $action = "\\App\\Http\\Default\\(:1)@(:2)")
- mca($middleware = array(), $action = "\\App\\Http\\(:1)\\(:2)@(:3)")
- get($url, $action, $middleware = array()) 见下面补充说明
- post
- delete
- put
- any($url, $action, $middleware = array(), $method = "\*") method可以为数组
- match 正则
- add404Handler 404回调
- addRegexpPlaceholder 添加更多正则占位符

路由器URL/action参数
---------------

[](#路由器urlaction参数)

- url 以#开头和结尾 或者 路径中包包含 :num :alpha :var 用正则匹配
- action 支持callback 或者 \\namespace\\class@method
- callback of action 第一个参数是request,第二个参数是matches,第三个参数是BOOL,表示此次是否是检测,
- atCall of action 第一个参数是matches ,类构造函数的参数是request,第二个参数是matches

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 97.6% 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 ~37 days

Recently: every ~13 days

Total

23

Last Release

2328d ago

Major Versions

v1.0 → v2.02018-03-03

2.2.6 → 3.0.02019-10-11

PHP version history (2 changes)v1.0PHP &gt;=5.4.0

v2.0PHP &gt;=5.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f29043b8f5aebb2d7a34302c1bc1626bd711398bb0c5387cd8630b45057a4c9?d=identicon)[awei.tian](/maintainers/awei.tian)

---

Top Contributors

[![aweitian](https://avatars.githubusercontent.com/u/6269615?v=4)](https://github.com/aweitian "aweitian (41 commits)")[![badtomcat](https://avatars.githubusercontent.com/u/33171263?v=4)](https://github.com/badtomcat "badtomcat (1 commits)")

---

Tags

prefixmodulecontrolrouteactionpathinfoaweitiantiananwei

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aweitian-route/health.svg)

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

###  Alternatives

[nwidart/laravel-modules

Laravel Module management

6.1k14.6M274](/packages/nwidart-laravel-modules)[pmjones/auto-route

Automatically routes HTTP request to action classes.

20158.6k6](/packages/pmjones-auto-route)

PHPackages © 2026

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