php-etl / array-expression-language
This library implements functions for manipulating array data in ExpressionLanguage
Installs: 3 559
Dependents: 0
Suggesters: 1
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/php-etl/array-expression-language
Requires
- php: >=8.2
- symfony/expression-language: ^6.0
- symfony/property-access: ^6.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- infection/infection: ^0.26.18
- php-etl/pipeline-contracts: *
- php-etl/satellite: ^0.6.7
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.0
- rector/rector: ^0.15
This package is auto-updated.
Last update: 2025-10-24 18:32:20 UTC
README
This package extends the ExpressionLanguage Symfony component to compile and evaluate arrays and iterables with custom functions.
Documentation
Installation
composer require php-etl/array-expression-language
Usage
You can use these expressions in your configuration files as in the following example :
foo: '@=count(input["myArray"])'
List of available functions
Generic functions
firstKey(array $array) : int|string|nulllastKey(array $array) : int|string|nullkeyExists(string|int $key, array $array) : boolmerge(array ...$arrays) : arraycount(Countable|array $value) : intcombine(array $keys, array $values) : arrayiterableToArray(Traversable $iterator, bool $use_keys = true) : arraymap(callable $callback, iterable $source) : iterablereduce(callable $callback, iterable $source) : stringlist(int $length, mixed $value) : iterablearrayFilter(array $array, ?callable $callback = null) : arraymapValues(array $input, iterable $values) : array
Functions that can be used with reduce
join(string $separator) : callable
Functions that can be used with map
extraxctData(string $path) : callable
Functions that can be used with arrayFilter
Any function can be used with this method as long as it returns true or false.