Download the PHP package hejunjie/simple-rule-engine without Composer

On this page you can find all versions of the php package hejunjie/simple-rule-engine. 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 simple-rule-engine

hejunjie/simple-rule-engine

简体中文 | English

A lightweight, easy-to-use PHP rule engine supporting multi-condition combinations and dynamic rule execution — ideal for business logic evaluation and data validation.

This project has been parsed by Zread. Click to explore the project structure and code navigation.


✨ Features


📋 Requirements


📦 Installation


🚀 Quick Start


📖 Usage

Basic Evaluation

Engine::evaluate() accepts a list of rules, data, and a combination strategy, returning a boolean.

Getting Detailed Results

Engine::evaluateWithDetails() returns the evaluation result for each rule:

Using RuleGroup

If you need more flexible composition (e.g., reusing the same group of rules across different scenarios), you can use RuleGroup directly:

Custom Operators

Implement the OperatorInterface and register through OperatorFactory:


🧩 Built-in Operators

Comparison Operators

Operator Description Example Value
== Equal to 18
!= Not equal to 18
> Greater than 18
>= Greater than or equal to 18
< Less than 18
<= Less than or equal to 18

Set Operators

Operator Description Example Value
in Value in array ['SG', 'MY', 'TH']
not_in Value not in array ['SG', 'MY', 'TH']

String Operators

Operator Description Example Value
contains Contains substring 'admin'
not_contains Does not contain substring 'admin'
start_swith Starts with 'VIP_'
end_swith Ends with '@example.com'

Range Operators

Operator Description Example Value
between Value within range [18, 65]
not_between Value outside range [18, 65]

Date Operators

Operator Description Example Value
before_date Date is before '2025-01-01'
after_date Date is after '2025-01-01'
date_equal Date is equal to '2025-01-01'

Date operators are powered by Carbon and support all common date formats as well as timestamps.


🎯 Use Cases


📁 Directory Structure


🧪 Running Tests


🙌 Contributing

If this project helps you, a Star ⭐ would be much appreciated!

For questions or suggestions, feel free to open an Issue. Let's make it better together.


All versions of simple-rule-engine with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
nesbot/carbon Version ^3.9
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 hejunjie/simple-rule-engine contains the following files

Loading the files please wait ...