PHPackages                             xavren/expression-language - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. xavren/expression-language

ActiveLibrary

xavren/expression-language
==========================

Symfony ExpressionLanguage Component Fork

0225PHP

Since Oct 15Pushed 10y agoCompare

[ Source](https://github.com/xavren/ExpressionLanguage)[ Packagist](https://packagist.org/packages/xavren/expression-language)[ RSS](/packages/xavren-expression-language/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

ExpressionLanguage Component
============================

[](#expressionlanguage-component)

The ExpressionLanguage component provides an engine that can compile and evaluate expressions:

```
use Hydra\Component\ExpressionLanguage\ExpressionLanguage;

$language = new ExpressionLanguage();

echo $language->evaluate('1 + foo', array('foo' => 2));
// would output 3

echo $language->compile('1 + foo', array('foo'));
// would output (1 + $foo)

```

By default, the engine implements simple math and logic functions, method calls, property accesses, and array accesses.

You can extend your DSL with functions:

```
$compiler = function ($arg) {
    return sprintf('strtoupper(%s)', $arg);
};
$evaluator = function (array $variables, $value) {
    return strtoupper($value);
};
$language->register('upper', $compiler, $evaluator);

echo $language->evaluate('"foo" ~ upper(foo)', array('foo' => 'bar'));
// would output fooBAR

echo $language->compile('"foo" ~ upper(foo)');
// would output ("foo" . strtoupper($foo))

```

Resources
---------

[](#resources)

You can run the unit tests with the following command:

```
$ composer.phar install --dev
$ phpunit

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/bc6b54ae7c6531dcd2754e8e1393811c7a5098baae263c876fbe2568c9e86045?d=identicon)[xavren](/maintainers/xavren)

---

Top Contributors

[![xavren](https://avatars.githubusercontent.com/u/2655636?v=4)](https://github.com/xavren "xavren (5 commits)")

### Embed Badge

![Health badge](/badges/xavren-expression-language/health.svg)

```
[![Health](https://phpackages.com/badges/xavren-expression-language/health.svg)](https://phpackages.com/packages/xavren-expression-language)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
