PHPackages                             tourze/condition-system-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. tourze/condition-system-bundle

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tourze/condition-system-bundle
==============================

A flexible condition system bundle for Symfony applications that provides condition evaluation, management and trigger mechanisms

0.1.1(6mo ago)05331MITPHPCI passing

Since May 27Pushed 4mo agoCompare

[ Source](https://github.com/tourze/condition-system-bundle)[ Packagist](https://packagist.org/packages/tourze/condition-system-bundle)[ RSS](/packages/tourze-condition-system-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (33)Versions (5)Used By (1)

Condition System Bundle
=======================

[](#condition-system-bundle)

[English](README.md) | [中文](README.zh-CN.md)

[![PHP Version](https://camo.githubusercontent.com/408d1443ac424f8286b1394832da99174fc981b28d2fbdfa3d1f33c434defb9c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e312d3738374342353f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/condition-system-bundle)[![License](https://camo.githubusercontent.com/c090e080484e2a2bc766446291d04437db823929042bf614b26a1643660ddf6f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e3f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://camo.githubusercontent.com/7dcd57f22e5d397a71b9698c80a53d43352412c41f6cb36ffd25cb56db0a2367/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275696c642d70617373696e672d627269676874677265656e3f7374796c653d666c61742d737175617265)](#)[![Coverage](https://camo.githubusercontent.com/50a4fbc8e51d67d8814fd8ab90d2cbd132da38b8d00c18c96634f969c20867a8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f7665726167652d3130302532352d627269676874677265656e3f7374796c653d666c61742d737175617265)](#)

A flexible condition evaluation system for Symfony applications, providing a framework for defining, managing, and evaluating various types of conditions.

Features
--------

[](#features)

- **Flexible Condition System**: Create and manage various types of conditions with custom handlers
- **Evaluation Engine**: Evaluate conditions against specific contexts and actors
- **Extensible Architecture**: Easy to add new condition types by implementing handlers
- **Trigger Support**: Built-in support for different condition triggers
- **Validation**: Comprehensive configuration validation for conditions
- **Batch Evaluation**: Evaluate multiple conditions at once

Installation
------------

[](#installation)

You can install this bundle via Composer:

```
composer require tourze/condition-system-bundle
```

### Requirements

[](#requirements)

- PHP 8.1 or higher
- Symfony 6.4 or higher
- Doctrine ORM 3.0 or higher

Quick Start
-----------

[](#quick-start)

1. Register the bundle in your `config/bundles.php`:

```
return [
    // ...
    Tourze\ConditionSystemBundle\ConditionSystemBundle::class => ['all' => true],
];
```

2. Create a custom condition handler:

```
use Tourze\ConditionSystemBundle\Handler\AbstractConditionHandler;
use Tourze\ConditionSystemBundle\Interface\ConditionInterface;
use Tourze\ConditionSystemBundle\ValueObject\EvaluationContext;
use Tourze\ConditionSystemBundle\ValueObject\EvaluationResult;

class MyCustomConditionHandler extends AbstractConditionHandler
{
    public function getType(): string
    {
        return 'my_custom_condition';
    }

    public function evaluate(ConditionInterface $condition, EvaluationContext $context): EvaluationResult
    {
        // Your evaluation logic here
        $passed = true; // Determine based on your logic

        return $passed
            ? EvaluationResult::pass()
            : EvaluationResult::fail(['Condition not met']);
    }
}
```

3. Use the condition manager:

```
use Tourze\ConditionSystemBundle\Service\ConditionManagerService;

// Create a condition
$condition = $conditionManager->createCondition($subject, 'my_custom_condition', [
    'threshold' => 100,
    'operator' => '>='
]);

// Evaluate a condition
$context = new EvaluationContext($actor, ['value' => 150]);
$result = $conditionManager->evaluateCondition($condition, $context);

if ($result->isPassed()) {
    // Condition passed
} else {
    // Condition failed
    $errors = $result->getMessages();
}
```

Configuration
-------------

[](#configuration)

### Dependencies

[](#dependencies)

This bundle depends on:

- `tourze/doctrine-timestamp-bundle`: Provides timestamp functionality for entities
- `tourze/enum-extra`: Enhanced enum support

### Advanced Usage

[](#advanced-usage)

#### Condition Triggers

[](#condition-triggers)

The bundle supports different condition triggers through the `ConditionTrigger` enum. You can filter available condition types by trigger:

```
$availableTypes = $conditionManager->getAvailableConditionTypes(ConditionTrigger::BEFORE_ACTION);
```

#### Batch Evaluation

[](#batch-evaluation)

Evaluate multiple conditions at once:

```
$results = $conditionManager->evaluateConditions($conditions, $context);
```

Testing
-------

[](#testing)

Run the test suite:

```
./vendor/bin/phpunit packages/condition-system-bundle/tests
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to this project.

License
-------

[](#license)

This bundle is under the MIT license. See the complete license in the bundle: [LICENSE](LICENSE)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance71

Regular maintenance activity

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~55 days

Total

4

Last Release

186d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e354fdb316da535dfa8ba2e9193a473c403b6bc6fb9170778d1dc50e304c6e9d?d=identicon)[tourze](/maintainers/tourze)

---

Top Contributors

[![tourze](https://avatars.githubusercontent.com/u/13899502?v=4)](https://github.com/tourze "tourze (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tourze-condition-system-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tourze-condition-system-bundle/health.svg)](https://phpackages.com/packages/tourze-condition-system-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
