This package extends the ExpressionLanguage Symfony component to compile and evaluate arrays and iterables with custom functions.
composer require php-etl/array-expression-language
You can use these expressions in your configuration files as in the following example :
foo: '@=count(input["myArray"])'
firstKey(array $array) : int|string|null
lastKey(array $array) : int|string|null
keyExists(string|int $key, array $array) : bool
merge(array ...$arrays) : array
count(Countable|array $value) : int
combine(array $keys, array $values) : array
iterableToArray(Traversable $iterator, bool $use_keys = true) : array
map(callable $callback, iterable $source) : iterable
reduce(callable $callback, iterable $source) : string
list(int $length, mixed $value) : iterable
arrayFilter(array $array, ?callable $callback = null) : array
mapValues(array $input, iterable $values) : array
join(string $separator) : callable
extraxctData(string $path) : callable
Any function can be used with this method as long as it returns true or false.