New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

elepunk/evaluator

Laravel package for symfony expression language component
192 9

Larablocks Analysis

elepunk/evaluator works with any PHP project: the latest release (v1.0.1, Feb 24, 2015) doesn't depend on Laravel.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • No release in the last 12 months (last: Feb 24, 2015)
  • 0 downloads a month (needs 10,000)
  • 9 GitHub stars (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: Feb 24, 2015.
  • No releases in the last 12 months.
  • First released: Feb 24, 2015.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 2, 2026.

Install
composer require elepunk/evaluator
Latest Version:v1.0.1
PHP:>=5.4
License:MIT
Last Updated:Feb 24, 2015
Links: GitHub  ·  Packagist
Maintainer: shopalicious

Evaluator

Build Status Scrutinizer Code Quality Coverage Status Latest Stable Version Latest Unstable Version License SensioLabsInsight

A Laravel package and Orchestra extension for symfony/expression-language component.

Installation

Simpy update the composer.json file and run composer install.

"require": {
	"elepunk/evaluator": "1.0.*"
}

Quick Installation

composer require "elepunk/evaluator=1.0.*"

Setup

If you are using Orchestra Platform, you can simply enable the extension or add the service provider. This will also load the Evaluator alias automatically.

'providers' => [
	'Elepunk\Evaluator\EvaluatorServiceProvider'
];

Adapter

This package provide Orchesta Memory as the default driver.

How To Use

Evaluating an expression

$test = [
    'foo' => 10,
    'bar' => 5
];

echo Evaluator::evaluate('foo > bar', $test); //this will return true

You can also save the expression rule.

$test = [
    'foo' => 10,
    'bar' => 5
];

Evaluator::expression()->add('test', 'foo > bar');

echo Evaluator::evaluateRule('test', $test); //this will return true

For supported expressions, visit the Symfony Expression Language Component.

Condition

Let say we want to implement 10% tax to our collection.

$item = [
    'price' => 100
];

$condition = [
    'target' => 'price',
    'action' => '10%',
    'rule' => 'price > 50'
];

Evaluator::expression()->add('tax', $condition);

$calculated = Evaluator::condition('tax', $item);

Item with multiplier.

$item = [
	'price' => 50,
	'quantity' => 2
];

$condition = [
    'target' => 'price',
    'action' => '10%',
    'rule' => 'price > 50',
    'multiplier' => 'quantity'
];

Evaluator::expression()->add('tax', $condition);

$calculated = Evaluator::condition('tax', $item);

Related Packages

elepunk/orchestrate

Orchestra platform extension generator

50 4
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

670,032,257 9,703
laravel/framework

The Laravel Framework.

640,572,096 35,338
laravel/tinker

Powerful REPL for the Laravel framework.

546,909,908 7,440

Version History

Version Released PHP License
v1.0.1 >=5.4 MIT
v1.0.0 >=5.4 MIT