meraki/route
Composer 安装命令:
composer require meraki/route
包简介
README 文档
README
Frameware-agnostic, Middleware-compatible routing framework for PHP 7+.
Installation
Composer
To install using Composer, enter the following at the command line:
composer require meraki/route
Usage
Getting Started
<?php require_once 'vendor/autoload.php'; use Meraki\Route\Collection; use Meraki\Route\Mapper; use Meraki\Route\Matcher; use Meraki\Route\MatchResult; // any psr7 and psr11 compliant library will work use Laminas\Diactoros\ServerRequestFactory; $map = new Mapper(new Collection()); $map->get('/', new ShowHomepage()); $map->get('/contact', new ShowContactForm()); $map->post('/contact', new SendContactForm()); $map->get('/users/:id', new DisplayEditUserForm()) ->name('display.user.profile') ->constrain(':id', Constraint::digit()); $map->get('/users/:id'); $matcher = new Matcher($map->getRules()); $result = $match->match(ServerRequestFactory::fromGlobals()); if ($result->isSuccessful()) { // handle a successful match } else { // handle a failed match 404,405,406,etc. }
Full Documentation
See the Wiki.
Testing
To run the tests, run the following script:
$ composer test
Contributing
Please see CONTRIBUTING and CONDUCT for details.
Security
If you discover any security related issues, please email nbish11@hotmail.com instead of using the issue tracker.
Credits
Without help from the following people, software and services, this project would not have been possible. So a big thank you to all.
Authors
Contributors
Software
Services
License
The MIT License (MIT). Please see the LICENSE file for more information.
统计信息
- 总下载量: 107
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-07-16