PHP code example of toxygene / simple-uri-template

1. Go to this page and download the library: Download toxygene/simple-uri-template 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/ */

    

toxygene / simple-uri-template example snippets


use Toxygene\SimpleUriTemplate\Lexer;
use Toxygene\SimpleUriTemplate\RegexParser;

$lexer = new Lexer();
$parser = new RegexParser($lexer);

echo $parser->parse('/one/{two}/three'); // #^/one/(?P<two>.+?)/three$#

use Toxygene\SimpleUriTemplate\Lexer;
use Toxygene\SimpleUriTemplate\UriParser;

$lexer = new Lexer();
$parser = new UriParser($lexer);

echo $parser->parse('/one/{two}/three', ['two' => 2]); // /one/2/three