PHP code example of anexia / param-parser

1. Go to this page and download the library: Download anexia/param-parser 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/ */

    

anexia / param-parser example snippets



use function Anexia\ParamParser\parse;

$result = parse('this-is-a-{param:string:option1,option2,option3}-expression');

$result[0]; // Gets a Anexia\ParamParser\Node\SequenceNode instance
$result[0]->getSequenceValue(); // Gets "this-is-a-" as a string

$result[1]; // Gets a Anexia\ParamParser\Node\ParamNode instance
$result[1]->getParamName(); // Gets "param" as a string
$result[1]->getParamType(); // Gets "string" as a string
$result[1]->getParamOptions(); // Gets ["option1", "option2", "option3"] as an array of strings

$result[2]; // Gets a Anexia\ParamParser\Node\SequenceNode instance
$result[2]->getSequenceValue(); // Gets "-expression" as a string


use function Anexia\ParamParser\parse;

$result = parse('this-is-a-\{param:string:option1,option2,option3\}-expression');

$result[0]; // Gets a Anexia\ParamParser\Node\SequenceNode instance
$result[0]->getSequenceValue(); // Gets "this-is-a-{param:string:option1,option2,option3}-expression" as a string