1. Go to this page and download the library: Download mojolyon/axiom library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mojolyon / axiom example snippets
// Setting rule with default values
$rule = new Rule('eligibleForDiscount');
$rule->add(new RuleElement\DateVariable('minCustomerSince', new \DateTime('2014-01-01 00:00:00')))
->add(new RuleElement\DateVariable('customerSince', new \DateTime('2014-01-01 00:00:00')))
->operator(Operator::GREATHER_THAN)
->variable('minOrder', 5)
->variable('customerNumberOrder', 0)
->operator(Operator::LESSERTHAN_OR_EQUAL)
->operator('and');
$ruleContext = new Context('eligibleForDiscountCustomer');
$ruleContext->add(new RuleElement\DateVariable('customerSince', new \DateTime('2013-12-11 22:00:00')))
->variable('customerNumberOrder', 13);
$isEligible = $rule->evaluate($ruleContext);
if ($isEligible->getValue()) {
echo "Customer eligible for discount";
} else {
echo "Customer not eligible for discount";
}
// will output "Customer eligible for discount"
// the rule is evaluate as : ((minCustomerSince > customerSince) and (minOrder <= customerNumberOrder))
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.