PHPackages                             iserter/expression-evaluator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. iserter/expression-evaluator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

iserter/expression-evaluator
============================

Evaluate string expressions in PHP without eval() function

5393PHP

Since Feb 14Pushed 10y ago3 watchersCompare

[ Source](https://github.com/iSerter/expression-evaluator)[ Packagist](https://packagist.org/packages/iserter/expression-evaluator)[ RSS](/packages/iserter-expression-evaluator/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Expression Evaluator
====================

[](#expression-evaluator)

I looked around so much to find an expression evaluator, and none of my findings supported logical and comparison operators. I created this package from a gist I found. I will be writing a service provider for Laravel 5.1 soon.

Example Usage
-------------

[](#example-usage)

> $exEngine = new ExpressionEvaluator\\Engine;

> echo $exEngine-&gt;evalute('5 + 3 \* 2');

> // outputs 11

Example evaluations
-------------------

[](#example-evaluations)

`5 + 3 * 2`

11

`(1 > 2 AND 3 < 2) OR 1+2 == 3`

0

`(3 > 2) AND (3 < 5)`

1

`(1 > 2) OR (3 < 5)`

1

`(1 > 2) OR (6 > 5)`

1

`(1 > 2) OR (6 < 5)`

0

`1 + 2 == 3`

1

`2 < 1 + 2`

2

`(2 < 1) + 2`

2

`((2 < 1) + 2) == 2`

1

`-8/-2`

4

`-8/2`

-4

`-8/-2 + 15 * 1`

19

Inspired by &amp; developed upon

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

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/ee28fe9d54e1c97a6001a5bb443136e0627e84956b9f1e961a3ccedcf24af758?d=identicon)[iserter](/maintainers/iserter)

---

Top Contributors

[![iSerter](https://avatars.githubusercontent.com/u/1284841?v=4)](https://github.com/iSerter "iSerter (9 commits)")

### Embed Badge

![Health badge](/badges/iserter-expression-evaluator/health.svg)

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

###  Alternatives

[umpirsky/currency-list

List of all currencies with names and ISO 4217 codes in all languages and all data formats.

326325.2k10](/packages/umpirsky-currency-list)[fuel/parser

FuelPHP 1.x Parser Package

601.2M5](/packages/fuel-parser)

PHPackages © 2026

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