Download the PHP package manychois/peval without Composer

On this page you can find all versions of the php package manychois/peval. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package peval

Peval - PHP Expression Evaluator

PHP Version

Peval is a secure PHP library for parsing and evaluating expressions with support for variables, functions, operators, objects and array structures. Built on top of the excellent nikic/php-parser library, Peval provides a safe and controlled environment for executing dynamic expressions at runtime without the risks associated with eval(). All unsafe PHP functions are strictly prohibited to ensure security.

Features

Category Description Examples
🔢 Arithmetic Arithmetic operations +, -, *, /, %, **, ()
🔍 Comparison Value and type comparison operators ==, !=, ===, !==, <, <=, >, >=, <=>
🧠 Logical Boolean logic operations &&, \|\|, !, and, or, xor
📚 Arrays Array creation and access operations [1, 2, 3], $arr[0], ['a' => 'Apple']
🔤 String String manipulation and interpolation 'abc', "Hello {$name}!", .
📝 Variables Dynamic variable resolution with context $variable
🔑 Object Access Object properties and constants $obj->prop, Class::CONST
📞 Function Calls Function and object method calls func(), $obj->method()
➡️ Arrow Functions Arrow function syntax for concise callbacks array_map(fn($x) => $x * 2, $array)
🔒 Security Unsafe functions prohibited No eval(), exec(), file operations, etc.
❓ Others Ternary and null coalescing ? :, ??

Installation

Requirements

Security

Peval prioritizes security by maintaining a comprehensive blacklist of unsafe PHP functions that are prohibited from execution. This includes:

This ensures that expressions can only perform safe computations without accessing external resources or executing potentially dangerous operations.

For a complete list of prohibited functions, please refer to the src/unsafe.php file in the source code.

Quick Start

Comparison with Other Libraries

symfony/expression-language

The symfony/expression-language library provides rich expression evaluation capabilities but it has a different syntax than PHP. Peval understands native PHP syntax, making it easier for PHP developers to use without learning a new syntax.

nikic/php-parser

The nikic/php-parser library is primarily a parser for PHP code. Its built-in evaluator ConstExprEvaluator can only handle constant expressions. Peval builds on top of it to provide a complete solution for evaluating expressions.

madorin/matex

The madorin/matex library focuses mainly on mathematical expressions and does not support complex data structures like arrays or objects. It is limited to numeric operations, while Peval supports a wide range of PHP features including strings, arrays, and objects.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


All versions of peval with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
nikic/php-parser Version ^5.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package manychois/peval contains the following files

Loading the files please wait ...