PHPackages                             kachnitel/entity-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. kachnitel/entity-expression-language

ActiveLibrary

kachnitel/entity-expression-language
====================================

Evaluates Symfony ExpressionLanguage strings against PHP objects, resolving properties via PropertyAccess with optional is\_granted() support

032↑1493.8%PHP

Since Mar 14Pushed 1mo agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

kachnitel/entity-expression-language
====================================

[](#kachnitelentity-expression-language)

Evaluates [Symfony ExpressionLanguage](https://symfony.com/doc/current/components/expression_language.html) strings against PHP objects, resolving properties through Symfony's `PropertyAccess` component with an optional `is_granted()` security function.

Installation
------------

[](#installation)

```
composer require kachnitel/entity-expression-language
```

Usage
-----

[](#usage)

```
use Kachnitel\EntityExpressionLanguage\EntityExpressionLanguage;

$lang = new EntityExpressionLanguage();

// Simple property comparison — calls getStatus() automatically
$lang->evaluate('entity.status == "pending"', $order);                  // bool

// Boolean property — calls isActive()
$lang->evaluate('entity.active', $product);

// Numeric comparison
$lang->evaluate('entity.stock > 0', $product);

// Combined conditions
$lang->evaluate('entity.status == "pending" && entity.stock > 0', $product);

// "item" is an alias for "entity"
$lang->evaluate('item.status == "draft"', $article);

// Explicit method call syntax
$lang->evaluate('entity.getStatus() == "pending"', $order);
```

### Security checks with `is_granted()`

[](#security-checks-with-is_granted)

Pass an `AuthorizationCheckerInterface` as the third argument to enable `is_granted()`:

```
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;

$lang->evaluate(
    'entity.status != "locked" && is_granted("ROLE_EDITOR")',
    $entity,
    $authorizationChecker,
);

// Pass entity as subject to a voter
$lang->evaluate('is_granted("ADMIN_EDIT", entity)', $entity, $authorizationChecker);
```

`is_granted()` returns `false` when no `AuthorizationCheckerInterface` is provided.

### Error handling

[](#error-handling)

Any parse or runtime error returns `false` — a misconfigured expression never throws.

Requirements
------------

[](#requirements)

- PHP 8.1+
- `symfony/expression-language` ^6.4|^7.0|^8.0
- `symfony/property-access` ^6.4|^7.0|^8.0
- `symfony/security-core` ^6.4|^7.0|^8.0

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance59

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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/1206e3a106f8c82c1dd68d4304c951d6979f39e5806de2a7a72724d825f06b38?d=identicon)[kachnitel](/maintainers/kachnitel)

---

Top Contributors

[![kachnitel](https://avatars.githubusercontent.com/u/4067705?v=4)](https://github.com/kachnitel "kachnitel (1 commits)")

### Embed Badge

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

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

PHPackages © 2026

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