PHP code example of oneguard / expression-language-extensions
1. Go to this page and download the library: Download oneguard/expression-language-extensions 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/ */
oneguard / expression-language-extensions example snippets
use OneGuard\ExpressionLanguageExtensions\Utils\FunctionGenerator;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
$function = FunctionGenerator::fromStaticFunction(Yaml::class, 'parse', 'yaml_parse');
$expressionLanguage = new ExpressionLanguage();
$expressionLanguage->addFunction($function);
$expressionLanguage->evaluate("yaml_parse('a: [1, 2]')");