2017 © Pedro Peláez
 

library url-matcher

image

ldrahnik/url-matcher

  • Tuesday, October 17, 2017
  • by ldrahnik
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,400 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

ldrahnik/url-matcher

Build Status Latest stable Downloads total, (*1)

Requirements

ldrahnik/url-matcher requires PHP 5.4 or higher., (*2)

Installation

Install url-matcher to your project using Composer:, (*3)

$ composer require ldrahnik/url-matcher

Usage

create url, (*4)

    $patterns = [
        'lang' => 'cz',
        'presenter' => 'home',
        'action' => 4
    ];
    $mask = '[<lang>/]<presenter>/<action>';
    $matcher = new Matcher($mask, $patterns);

        $results = $matcher->parse();
        /*array [
         'home/4',
         'cz/home/4',
    ];*/

confirm url, (*5)

    $mask = '[<lang>/]<presenter>[/<action>]';
    $matcher = new Matcher($mask);

    $result = $matcher->match('en/admin');
    // true

Examples

    $mask = 'root/<folder>/<subfolder>/<file>.latte';

    $matcher = new UrlMatcher\Matcher($mask, [
        'folder' => '*',
        'subfolder' => 'foo',
        'file' => '*'
    ]);

    $mask = $matcher->parse();
    // root/*/foo/*.latte

    foreach (glob($mask) as $filename) {
        echo basename($filename);
    }

Configuration

    $default = [
        'separator_lft' => '<',     
        'separator_rgt' => '>',     
        'optional_lft' => '[',      
        'optional_rgt' => ']'
    ];
    $matcher = new Matcher(..., ..., $default);

The Versions

17/10 2017

dev-master

9999999-dev https://github.com/ldrahnik/url-matcher

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

10/05 2015

v2.0

2.0.0.0 https://github.com/ldrahnik/url-matcher

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

30/03 2015

v1.0

1.0.0.0 https://github.com/ldrahnik/url-matcher

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires