PHPackages                             nicolasjourdan/business-logic-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. nicolasjourdan/business-logic-bundle

ActiveSymfony-bundle

nicolasjourdan/business-logic-bundle
====================================

This bundle helps you to create and to implement your business logic

1.1.0(5y ago)27MITPHPPHP ^7.2|^8.0

Since Dec 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/NicolasJourdan/business-logic-bundle)[ Packagist](https://packagist.org/packages/nicolasjourdan/business-logic-bundle)[ Docs](https://github.com/NicolasJourdan/business-logic-bundle)[ RSS](/packages/nicolasjourdan-business-logic-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

Business Logic Bundle
=====================

[](#business-logic-bundle)

[![Build Status](https://camo.githubusercontent.com/54e51510b3defd1c1ca204f1e2e61fd35cb202a471e679fcad2f7b2b67ae6826/68747470733a2f2f7472617669732d63692e6f72672f4e69636f6c61734a6f757264616e2f627573696e6573732d6c6f6769632d62756e646c652e7376673f6272616e63683d6d61696e)](https://travis-ci.org/github/NicolasJourdan/business-logic-bundle)[![Latest Stable Version](https://camo.githubusercontent.com/48e53bbf9867200019b624683527927fa2d2372f3bd8b880409500b429a4297e/68747470733a2f2f706f7365722e707567782e6f72672f6e69636f6c61736a6f757264616e2f627573696e6573732d6c6f6769632d62756e646c652f76)](//packagist.org/packages/nicolasjourdan/business-logic-bundle)[![Total Downloads](https://camo.githubusercontent.com/7af249b4ed56f5e76ed44bfe993e4703ded5572662ef1812b274f0d5ff56ed82/68747470733a2f2f706f7365722e707567782e6f72672f6e69636f6c61736a6f757264616e2f627573696e6573732d6c6f6769632d62756e646c652f646f776e6c6f616473)](//packagist.org/packages/nicolasjourdan/business-logic-bundle)[![Latest Unstable Version](https://camo.githubusercontent.com/7271c9c22a7cefade606ad4d42d69e98d73458b9f690472102adf4db857b5f6f/68747470733a2f2f706f7365722e707567782e6f72672f6e69636f6c61736a6f757264616e2f627573696e6573732d6c6f6769632d62756e646c652f762f756e737461626c65)](//packagist.org/packages/nicolasjourdan/business-logic-bundle)[![License](https://camo.githubusercontent.com/2fc8c0fb980fd2ded6640d840931a28a08518816e1ea7b69d4330dae7bd7e978/68747470733a2f2f706f7365722e707567782e6f72672f6e69636f6c61736a6f757264616e2f627573696e6573732d6c6f6769632d62756e646c652f6c6963656e7365)](//packagist.org/packages/nicolasjourdan/business-logic-bundle)

The **BusinessLogicBundle** helps you to create and to implement your business rules.

Installation
============

[](#installation)

### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute:

```
$ composer require nicolasjourdan/business-logic-bundle
```

### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project:

```
// config/bundles.php

return [
    // ...
    NicolasJourdan\BusinessLogicBundle\NicolasJourdanBusinessLogicBundle::class => ['all' => true],
];
```

Documentation
=============

[](#documentation)

The source of the documentation is stored in the `Resources/doc/` folder in this bundle. The full documentation is [here](Resources/doc/index.md).

This bundle implements 3 design patterns (Specification, Rules and Chain of responsibility) in order to define a system to help you to create your own business rules.

There are 3 important objects in this conception :

- **Specification** : This is your business condition. It is used to define if a business rule has to be executed on the current candidate.
- **Rule** : This is your business rule.
- **RulesEngine** : This object contains several rules and executes ones which have to be executed on the current candidate.

Please, feel free to see the [demo](https://github.com/NicolasJourdan/demo-business-logic-bundle).

Basic Usage
===========

[](#basic-usage)

Create a Specification
----------------------

[](#create-a-specification)

### The specification class

[](#the-specification-class)

```
