2017 © Pedro Peláez
 

library preport

A simple PHP rule engine.

image

okeyaki/preport

A simple PHP rule engine.

  • Sunday, January 3, 2016
  • by okeyaki
  • Repository
  • 0 Watchers
  • 1 Stars
  • 23 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Preport

A simple PHP rule engine., (*1)

Usage

1. Build reporter.

use Preport\Reporter;

$reporter = new Reporter;

$reporter->report('too_short_input')
    ->where(function () use ($input) {
        return strlen($input) < 4;
    });

$reporter->report('too_long_input')
    ->where(function () use ($input) {
        return strlen($input) > 8;
    })
    ->unless('too_short_input');

$reporter->report('no_input')
    ->where(function () use ($input) {
        return !$input;
    });
    ->when('too_short_input');

2. Get reports.

$reports = $reporter->walk();

foreach ($reports as $report) {
    echo $report->subject();
}
> $input = 'foo';
too_short_input

> $input = '';
too_short_input
no_input

> $input = 'foobarbaz';
too_long_input

The Versions

03/01 2016

dev-master

9999999-dev

A simple PHP rule engine.

  Sources   Download

MIT

The Requires

  • php ~5.5

 

27/12 2015

0.1.0

0.1.0.0

A simple PHP rule engine.

  Sources   Download

MIT

The Requires

  • php ~5.5