PHPackages                             cjeruen/route-for-zanphp - 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. cjeruen/route-for-zanphp

ActiveLibrary[Framework](/categories/framework)

cjeruen/route-for-zanphp
========================

route for zanphp

06PHP

Since Nov 2Pushed 8y agoCompare

[ Source](https://github.com/cjeruen/route-for-zanphp)[ Packagist](https://packagist.org/packages/cjeruen/route-for-zanphp)[ RSS](/packages/cjeruen-route-for-zanphp/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

route for zanphp
================

[](#route-for-zanphp)

功能说明
----

[](#功能说明)

> ~ 在 zanphp 中 使用 FastRoute 路由
>
> ~ 兼容 zanphp 默认 路由

使用说明
----

[](#使用说明)

### 1. 安装

[](#1-安装)

`composer require cjeruen/route-for-zanphp:dev-master`

### 2. 配置

[](#2-配置)

#### 2.1 启动加载

[](#21-启动加载)

`init/WorkerStart/.config.php`

或者

`init/ServerStart/.config.php`

```
return [
    // other initialize
    \Com\JeRuen\Zan\Routing\FastRoute\InitializeRouter::class,
];

```

#### 2.2 配置路由类型

[](#22-配置路由类型)

`resource/config/share/route.php`

```
return [
    'default_route' => '/index',
    'default_controller' => 'index',
    'default_action' => 'index',
    'default_format' => 'html',

    'router_class' => 'Com\JeRuen\Zan\Routing\FastRoute\Router',
    'router_path' => 'src/routing.php',

    // compatible use zan router if not found. default false
    // 是否开启兼容zan路由(未匹配则找zan默认路由匹配)
    'router_compatible' => true,

];
```

#### 2.3 定义路由规则

[](#23-定义路由规则)

```
