PHPackages                             crisu83/php-expression - 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. crisu83/php-expression

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

crisu83/php-expression
======================

A modest library for safe evaluation of PHP expressions.

333

Since Jul 22Compare

[ Source](https://github.com/Crisu83/php-expression)[ Packagist](https://packagist.org/packages/crisu83/php-expression)[ RSS](/packages/crisu83-php-expression/feed)WikiDiscussions Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

php-expression
==============

[](#php-expression)

A modest library for safe evaluation of PHP expressions.

Why would I want that?
----------------------

[](#why-would-i-want-that)

Sometimes you cannot avoid using eval in php, e.g. if you have a rules engine that uses php expressions and its business rules. When you need to use eval you want a safe environment to do so, that's where php-expression comes in. Using php-expression you can check the syntax, safely test your expressions before evaluating them and catch exceptions that may occur. By default php-expression does not allow to use any language constructs or functions, but you can configure it to allow anything you want.

How do I use it?
----------------

[](#how-do-i-use-it)

```
