2017 © Pedro PelĂĄez
 

library business-rule-engine-bundle

Reusable library

image

mpoiriert/business-rule-engine-bundle

Reusable library

  • Thursday, March 27, 2014
  • by mpoiriert
  • Repository
  • 1 Watchers
  • 0 Stars
  • 661 Installations
  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Business Rule Engine Bundle

Build Status, (*1)

Integration of the BusinessRuleEngine as a Symfony bundle., (*2)

You should read the Business Rule Engine documentation to know how and why to use it. The current documentation is meant to explain and to enable it and configure it in symfony., (*3)


<?php // in AppKernel::registerBundles() $bundles = array( // ... new Nucleus\Bundle\BusinessRuleEngineBundle\NucleusBusinessRuleEngineBundle(), // ... );

From there you can use the BusinessRuleEngine., (*4)

The service is named nucleus.business_rule_engine so you can access it via the service container like this:, (*5)


<?php $businessRuleEngine = $serviceContainer->get('nucleus.business_rule_engine');

Or injecting it in your service. Be sure to use the interface Nucleus\BusinessRuleEngine\IBusinessRuleEngine when you are referencing the object., (*6)

Adding a service as a rule

To add a service as a rule you need to tag the specific service., (*7)


<service id="my_namespace.my_module.my_service" class="MyNamespace\MyModule\MyServiceClass"> <tag name="nucleus.business_rule_engine.rule" ruleName="myRuleName" /> </service>

The example is in xml, refer to symfony doc to know how to tag in YML or PHP., (*8)

The tag named nucleus.business_rule_engine.rule is use by this bundle to know witch service are a rule. The attribute ruleName will be the one you must refer when calling the business rule engine., (*9)

Since the BusinessRuleEngine is expecting a callable to be a rule, be sure to implement the __invoke magic method in php on your service., (*10)


<?php namespace MyNamespace\MyModule; class MyServiceClass { /* ... */ public function __invoke($toto) { /* ... do processing ... */ return $result;//The business rule engine expect to receive a boolean value in return } }

In the bundle we are implementing a IRuleProvider that is ContainerAware so service will not be loaded until you call a rule., (*11)

documentation for the integration in symfony, (*12)

The Versions

27/03 2014

dev-master

9999999-dev

Reusable library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Poirier ThĂ©orĂȘt

library bundle symfony specification nucleus business-rule-engine