Download the PHP package softonic/jaxer without Composer
On this page you can find all versions of the php package softonic/jaxer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download softonic/jaxer
More information about softonic/jaxer
Files in softonic/jaxer
Package jaxer
Short Description PHP Engine Rule to rule them all
License Apache-2.0
Homepage https://github.com/softonic/jaxer
Informations about the package jaxer
Jaxer
One rule engine to rule them all
Jaxer allows you to evaluate complex rules in an easy way and know the reason behind the validation result.
Main features
- Evaluate rules.
- Rules evaluation tracing.
- Provide generic rules:
Installation
You can require the last version of the package using composer
Usage
The rules are classes that needs to implement \Softonic\Jaxer\Rules\Rule
interface. They usually get their input
parameters through constructor like for example:
As you can see there is a part dedicated to the business logic in the isValid
method and a getContext
method that
allows you to track the rule information.
On the other hand, this library provide generic rules, which help to evaluate complex rules. These logical operation are: NOT.
Example using AndRule, OrRule and NotRule
After a validation is evaluated, you can execute isValid
as many times you want without performance impact because it
is evaluated only the first time it is called.
Advanced Usage
Rules with inner rules
Sometimes you need to create a rule that contain other rules, like for example NOT. Those rules contain other rules that need to be evaluated in validation time.
To evaluate a rule you need to encapsulate it in a Validation
object. It will decorate the rule adding state and a common context format.
Logical Not Example:
Testing
softonic/jaxer
has a PHPUnit test suite, and a coding style compliance test suite using PHP CS Fixer.
To run the tests, run the following command from the project folder.
To open a terminal in the dev environment:
License
The Apache 2.0 license. Please see LICENSE for more information.