PHPackages                             kevintherm/exprc - 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. kevintherm/exprc

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

kevintherm/exprc
================

Convert expression string to in-memory evaluation, SQL syntax, or something else.

v0.0.3(1mo ago)12251MITPHPPHP ^8.2

Since Apr 3Pushed 1mo agoCompare

[ Source](https://github.com/kevintherm/exprc)[ Packagist](https://packagist.org/packages/kevintherm/exprc)[ RSS](/packages/kevintherm-exprc/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (2)Versions (4)Used By (1)

Exprc
=====

[](#exprc)

Exprc is a tiny, decoupled rule engine for PHP

It parses rule strings into an AST once, then lets you evaluate that AST with different backends:

- in-memory records
- Laravel query builders
- custom callback handlers

Prerequisites
-------------

[](#prerequisites)

- PHP 8.2+

Install
-------

[](#install)

```
composer require kevintherm/exprc
```

For Laravel QueryBuilder support:

```
composer require illuminate/database
```

Architecture
------------

[](#architecture)

Rule string -&gt; Lexer -&gt; Parser -&gt; AST -&gt; Evaluator

Core parser and AST are framework-agnostic. Evaluators are swappable adapters.

Supported Operators
-------------------

[](#supported-operators)

- `=` / `!=`
- `>` / `>=` / `
