2017 © Pedro Peláez
 

symfony-bundle rulerz-bundle

Symfony2 Bundle for RulerZ

image

kphoen/rulerz-bundle

Symfony2 Bundle for RulerZ

  • Wednesday, April 18, 2018
  • by K-Phoen
  • Repository
  • 4 Watchers
  • 31 Stars
  • 80,465 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 14 Forks
  • 3 Open issues
  • 25 Versions
  • 8 % Grown

The README.md

RulerZBundle Build Status

This bundle integrates RulerZ into Symfony., (*1)

Installation

Require the bundle:, (*2)

composer require 'kphoen/rulerz-bundle'

And declare it into your app/AppKernel.php file:, (*3)

public function registerBundles()
{
    return array(
        // ...
        new KPhoen\RulerZBundle\KPhoenRulerZBundle(),
    );
}

Usage

This bundle registers a rulerz service which is an instance of RulerZ\RulerZ., (*4)

$rulerz = $this->container->get('rulerz');

$rulerz->filter(/* ... */);

See RulerZ's documentation for more information., (*5)

Custom operators

Custom operators can be added to RulerZ executors. The bundle provide a way to register new operators directly from the container, you just need to tag a service:, (*6)

services:
    operator.array.like:
        class: RulerZ\Operator\ArrayExecutor\Like
        tags:
            - { name: rulerz.operator, target: native, operator: like }

In addition to the rulerz.operator tag, two other values are needed: * target: the compilation target we want to register the operator for ; * operator: the name that will be given to the operator in rules., (*7)

Important: Operators registered as classes must implement the __invoke magic method as RulerZ expects custom operators to be defined as callable., (*8)

Validators

A rule validator is provided by the bundle. In its simplest form, it will only validate the syntax of a given rule. Unknown variables or operators won't be detected unless you define a whitelist of accepted values., (*9)

use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\RulerZ\Validator\Constraints as RulerZAssert;

class TaggingRule
{
    /**
     * @var string
     *
     * @Assert\NotBlank()
     * @RulerZAssert\ValidRule(
     *  allowed_variables={"title", "url", "isArchived", "isStared", "content", "language", "mimetype", "readingTime", "domainName"},
     *  allowed_operators={">", "<", ">=", "<=", "=", "is", "!=", "and", "not", "or"}
     * )
     */
    private $rule;
}

Configuration reference

# app/config/config.yml

rulerz:
    cache: "%kernel.cache_dir%/rulerz"
    debug: "%kernel.debug%"

    targets:
        native: false
        doctrine: false
        doctrine_dbal: false
        eloquent: false
        pomm: false
        solarium: false
        elasticsearch: false

The targets section allows you to enable only the compilation targets needed by your application., (*10)

Licence

This bundle is under the MIT licence., (*11)

The Versions

13/11 2015
13/11 2015
11/11 2015
01/11 2015
01/11 2015
22/10 2015

0.7.3

0.7.3.0 https://github.com/K-Phoen/RulerZBundle

Symfony2 Bundle for RulerZ

  Sources   Download

MIT

The Requires

 

The Development Requires

doctrine specification ruler rulerz

19/10 2015

0.7.2

0.7.2.0 https://github.com/K-Phoen/RulerZBundle

Symfony2 Bundle for RulerZ

  Sources   Download

MIT

The Requires

 

The Development Requires

doctrine specification ruler rulerz

19/10 2015

0.7.1

0.7.1.0 https://github.com/K-Phoen/RulerZBundle

Symfony2 Bundle for RulerZ

  Sources   Download

MIT

The Requires

 

The Development Requires

doctrine specification ruler rulerz

18/10 2015

0.7.0

0.7.0.0 https://github.com/K-Phoen/RulerZBundle

Symfony2 Bundle for RulerZ

  Sources   Download

MIT

The Requires

 

doctrine specification ruler rulerz

17/10 2015

0.6.0

0.6.0.0 https://github.com/K-Phoen/RulerZBundle

Symfony2 Bundle for RulerZ

  Sources   Download

MIT

The Requires

 

doctrine specification ruler rulerz

14/10 2015

0.5.0

0.5.0.0 https://github.com/K-Phoen/RulerZBundle

Symfony2 Bundle for RulerZ

  Sources   Download

MIT

The Requires

 

doctrine specification ruler rulerz

05/03 2015

0.4.0

0.4.0.0 https://github.com/K-Phoen/RulerZBundle

Symfony2 Bundle for RulerZ

  Sources   Download

MIT

The Requires

 

doctrine specification

23/02 2015

0.3.0

0.3.0.0 https://github.com/K-Phoen/RulerZBundle

Symfony2 Bundle for RulerZ

  Sources   Download

MIT

The Requires

 

doctrine specification

09/02 2015

0.2.0

0.2.0.0 https://github.com/K-Phoen/RulerZBundle

Symfony2 Bundle for RulerZ

  Sources   Download

MIT

The Requires

 

doctrine specification

07/02 2015

0.1.0

0.1.0.0 https://github.com/K-Phoen/RulerZBundle

Symfony2 Bundle for RulerZ

  Sources   Download

MIT

The Requires

 

doctrine specification