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

ActiveLibrary

zodream/route
=============

route

5.3(2y ago)075MITPHPPHP &gt;=8.2

Since Jan 4Pushed 3d ago1 watchersCompare

[ Source](https://github.com/zodream/route)[ Packagist](https://packagist.org/packages/zodream/route)[ Docs](https://github.com/zodream/html)[ RSS](/packages/zodream-route/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (10)Dependencies (3)Versions (12)Used By (0)

route
=====

[](#route)

路由导航

获取指定模板的路径
---------

[](#获取指定模板的路径)

app(Router::class)-&gt;module('name', );

module 包含三个参数

```
string $name 可以使用url 路径，也可以是模块命名空间
callable $handle 默认为空，返回数组[路径, 模块命名空间]，为匿名方法时，url('./') 所使用的为模块的路径,支持匿名方法返回值
array $modules 默认未空，表示自动从配置文件中取所有注册模块
返回值，如果未找到注册的模板，则返回false, 找到了没有匿名方法返回数组[路径, 模块命名空间]，其他返回匿名方法返回的值

```

自定义路由
-----

[](#自定义路由)

路由文件

```
$router->get('gggggg', 'HomeController@aboutAction');
$router->group([
    'module' => 'Module\Blog\Module',
    'namespace' => '\Module\Blog\Service'
], function ($router) {
   $router->get('hhh/{id}/{name}?', 'HomeController@indexAction');
   $router->get('hhh', 'HomeController@indexAction');
});
```

服务提供

```
class RouteServiceProvider extends ServiceProvider {
    public function register()
    {
        $this->mapWebRoutes($this->app->make(Router::class));
    }
    protected function mapWebRoutes(Router $router)
    {
        $router->group([
            'namespace' => 'Service\Home',
        ], __DIR__.'/routes.php');
    }
}
```

BUG
---

[](#bug)

模块判断

注册 'chat' =&gt; 'Module/Chat'

请求路径可以是 /chat/a 也可以是 /chata 都能正确导向 模块中的 a 方法

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance65

Regular maintenance activity

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

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

Recently: every ~302 days

Total

11

Last Release

781d ago

Major Versions

1.4 → 2.02020-03-28

2.1 → 5.02021-03-19

PHP version history (4 changes)v1.0PHP &gt;=5.6.0

5.0PHP &gt;=8.0

5.2PHP &gt;=8.1

5.3PHP &gt;=8.2

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

routezodream

### Embed Badge

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

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

###  Alternatives

[league/route

Fast routing and dispatch component including PSR-15 middleware, built on top of FastRoute.

6633.1M115](/packages/league-route)[aura/router

Powerful, flexible web routing for PSR-7 requests.

5231.5M67](/packages/aura-router)[pecee/simple-router

Simple, fast PHP router that is easy to get integrated and in almost any project. Heavily inspired by the Laravel router.

696214.6k17](/packages/pecee-simple-router)[illuminatech/url-trailing-slash

Allows enforcing URL routes with or without trailing slash

50216.9k](/packages/illuminatech-url-trailing-slash)[contributte/api-router

RESTful Router for your Apis in Nette Framework - created either directly or via attributes

20802.8k3](/packages/contributte-api-router)

PHPackages © 2026

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