1. Go to this page and download the library: Download slexx/pattern 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/ */
slexx / pattern example snippets
use Slexx\Pattern\Pattrn;
$pattern = new Pattern('/users/<id:int>');
var_dump($pattern->match('/users/5')); // -> ['id' => 5]
$pattern = new Pattern('users show <id:slug>');
$pattern->rule('slug', '[\w\d\-]+');
$pattern->match('users show alex1234');
// -> ['slug' => 'alex1234'];
$pattern->match('users show {}+');
// -> null
$pattern = new Pattern('users list[ --verbose[ <verbose:bool>]][ --offset <offset:int>][ --limit <limit:int>]');
$pattern->match('users list --verbose on --offset 5');
// -> ['verbose' => true, 'offset' => 5, 'limit' => null];