weew/router-configurator
Composer 安装命令:
composer require weew/router-configurator
包简介
Makes weew/router configurable trough config files.
README 文档
README
Table of contents
Installation
composer require weew/router-configurator
Introduction
This package makes the weew/router configurable trough config files or arrays. It is recommended to use the weew/config package for the loading of config files.
Usage
In this example I'll be using a configuration written in yaml:
# same as $router->addFilter('auth', [AuthFilter::class, 'filter'); filters: - name: auth filter: [Foo\Bar\AuthFilter, filter] # same as $router->addResolver('user', [UserResolver::class, 'resolve'); resolvers: - name: user resolver: [Foo\Bar\UserResolver, resolve] # same as $router->restrictProtocol(['http', 'https']) protocol: [http, https] # same as $router->restrictTLD(['com', 'net']) tld: [com, net] # same as $router->restrictDomain(['foo', 'bar']) domain: [foo, bar] # same as $router->restrictSubdomain(['foo', 'bar']) subdomain: [foo, bar] # same as $router->restrictHost(['foo.com']) host: foo.com # same as $router->group() groups: # name is for readability only - name: public # same as $router->setController(HomeController::class) controller: HomeController routes: # same as $router->get('/', 'homeAction') - method: GET path: / action: homeAction # same as $router->route(['GET', 'POST'], 'contactAction') - method: [GET, POST] path: contact action: contactAction - name: api # same as $router->enableFilter('auth') filter: auth # same as $router->addPrefix('api/v1') prefix: api/v1 groups: - name: users controller: Foo\Bar\UserController prefix: /users routes: - route: GET / action: list - route: POST / action: create - rotue: GET {user} action: show - route: PUT PATCH {user} update
统计信息
- 总下载量: 109
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-16