honda/url-pattern-matcher
Composer 安装命令:
composer require honda/url-pattern-matcher
包简介
Check if a given path matches a given pattern.
README 文档
README
Checks if a given path like (/articles/4) matches a given pattern like (/articles/*).
Installation
You can install the package via composer:
composer require honda/url-pattern-matcher
Usage
Trailing forward slashes are ignored so the matcher will match /example, example, example/, /example/ if given /example.
use Honda\UrlPatternMatcher\UrlPatternMatcher; $urlPatternMatcher = new UrlPatternMatcher('/articles/edit'); $urlPatternMatcher->match('/articles'); // See fnmatch() function for reference on how the matching works. $urlPatternMatcher->match('/articles/*/edit'); // Matches if the path starts with /articles $urlPatternMatcher->match('^/articles'); // Matches if the path ends with /articles $urlPatternMatcher->match('/articles$');
Testing
There is 100% code coverage for this package, it's rare, most of the time useless, but it feels good :)
composer test
Url Pattern Matcher was created by Félix Dorn under the MIT license.
统计信息
- 总下载量: 2.61k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-17