Add it to your list of Composer dependencies:
composer require oneguard/expression-language-extensions
Create ExpressionFunction
from static function:
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]')");
This bundle is under the MIT license. See the complete license attached with the source code:
Issues and feature requests are tracked in the Github issue tracker.