Download the PHP package di/expression-parser without Composer
On this page you can find all versions of the php package di/expression-parser. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package expression-parser
⛓ Expression Parser v0.2.3
This package allows to evaluate (parse with mapping) large amounts of data in flexible manner, providing various processing functions:
🔩 Install
composer install di/expression-parser
⚒ Usage
👀 Example
Standard function handlers
🔗 Parameter substitution
📥 Input:
📤 Output: 1
🔗 Parameter substitution with has()
function
📥 Input:
📤 Output: true
🔗 Substitution with in_array()
function and scalar value
📥 Input:
📤 Output: true
🔗 Nested in_array()
and explode()
function and scalar value
📥 Input:
📤 Output: true
🔗 Substitution with matches_in_array()
function
📥 Input:
📤 Output: true
🔗 Nested explode()
is_empty()
and functions
📥 Input:
📤 Output: true
🔗 implode()
with inline parameter substitution
📥 Input:
📤 Output: hello world
🔗 implode()
with inline parameter substitution and a separator flag
📥 Input:
📤 Output: hello,world
🔗 explode()
with array substitution
📥 Input:
📤 Output: ['Pantry', 'Study']
Standard handlers with one or multiple flags
🔗 explode()
with array substitution and a separator flag
📥 Input:
📤 Output: ['Pantry', 'Study']
🔗 get()
function with count
and nullable
flags
📥 Input:
📤 Output: 3
🔗 Nested mapping with map
flag in get()
function
📥 Input:
📤 Output: 2
🔗 Case sensitive matching in array with sensitive
flag
📥 Input:
📤 Output: false
Logical handlers
🔗 equal()
function
📥 Input:
📤 Output: true
🔗 great_than()
function
📥 Input:
📤 Output: true
🔗 Nested not()
and equal()
functions
📥 Input:
📤 Output: true
🔗 Nested not()
and equal()
functions
📥 Input:
📤 Output: true
Complex functions with unlimited nesting level
🔗 Multiple function parameter substitution with nesting with and_x()
📥 Input:
📤 Output: true
🔗 Multiple function parameter substitution with nesting with or_x()
📥 Input:
📤 Output: true
🔗 Multiple function parameter substitution with nesting with or_x()
and not()
📥 Input:
📤 Output: true
😳 Multiple nesting with a Closure
📥 Input:
📤 Output: 20
Laravel Collection
helpers
The package already has a built-in support of Laravel Collection helpers. For more informations about the available functions it supports please refer to the original Laravel Collection documentation page.
🔗 Example usage of Laravel Collection functions
📥 Input:
📤 Output: 'value 1'
Extending with custom handlers
In order to extend or override current functionality, you will need to add your own handler class name to config/handlers.php
file:
😍 Contribution
Please feel free to fork and help developing.
📃 License
All versions of expression-parser with dependencies
phpunit/phpunit Version ^7.1
nikic/php-parser Version ^4.0@dev
localheinz/json-normalizer Version dev-master