PHP code example of honda / url-pattern-matcher

1. Go to this page and download the library: Download honda/url-pattern-matcher library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

honda / url-pattern-matcher example snippets


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$');