承接 phprivoxy/matcher 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

phprivoxy/matcher

最新稳定版本:v0.7.0

Composer 安装命令:

composer require phprivoxy/matcher

包简介

Simple URI matcher without regular expressions.

README 文档

README

Simple URI matcher.

Requirements

  • PHP >= 8.1

Installation

Using composer (recommended)

composer create phprivoxy/matcher

Does pattern match the URI

$uri = 'www.site.ru/cat/page.html';
$matcher = new PHPrivoxy\Matcher\UriMatcher($uri);

$matcher->match('*');               // TRUE
$matcher->match('.');               // TRUE
$matcher->match(''); // FALSE
$matcher->match('site.ru'); // FALSE
$matcher->match('.site.ru');        // TRUE
$matcher->match('*.site.ru');       // TRUE
$matcher->match('*site*');          // TRUE
$matcher->match('.ite.ru'); // FALSE
$matcher->match('*ite.ru');         // TRUE
$matcher->match('/page.html'); // FALSE
$matcher->match('/*page.html');     // TRUE
$matcher->match('/ca');             // TRUE
$matcher->match('/ca*');            // TRUE
$matcher->match('/ca$'); // FALSE
$matcher->match('/cat/page.html$'); // TRUE
$matcher->match('/cat/page.html');  // TRUE
$matcher->match('/cat/page.htm');   // TRUE
$matcher->match('/cat/page.htm');   // TRUE
$matcher->match('*ite.ru/cat/pag'); // TRUE
$matcher->match('*/cat/page.*');    // TRUE

Any samples you also may find at "tests" directory.

Does URI match the patterns

$patterns = [
    '.яндекс.рф/search',
    'microsoft.com/office',
    '*.microsoft.com/windows',
    '.windows.com',
    'github.com',
    '*linux*'
];

$matcher = new PHPrivoxy\Matcher\PatternsMatcher($patterns);
$matcher->match('https://www.яндекс.рф/'); // FALSE
$matcher->match('https://www.яндекс.рф/search.html');    // TRUE
$matcher->match('https://www.linuxmint.com/');           // TRUE
$matcher->match('https://www.microsoft.com/other/linux-vs-windows/'); // FALSE
$matcher->match('https://www.github.com/windows'); // FALSE
$matcher->match('https://github.com/os2');               // TRUE
$matcher->match('https://linux.github.com/');            // TRUE
$matcher->match('https://www.microsoft.com/office'); // FALSE
$matcher->match('https://microsoft.com/office2024');     // TRUE
$matcher->match('http://left.site/not-exist.html'); // FALSE

License

MIT License See LICENSE

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-28