oneguard/expression-language-extensions

Useful extensions to Symfony Expression Language

1.0.0 2018-10-29 13:09 UTC

This package is auto-updated.

Last update: 2024-10-29 05:34:22 UTC


README

Build Status Coverage Status Maintainability GitHub license Packagist Packagist PHP from Packagist

Installation

Add it to your list of Composer dependencies:

composer require oneguard/expression-language-extensions

Usage

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]')");

License

This bundle is under the MIT license. See the complete license attached with the source code:

LICENSE

Reporting an issue or a feature request

Issues and feature requests are tracked in the Github issue tracker.