onOrderCreated), but Laravel’s event system would need bridge logic (e.g., converting Symfony events to Laravel listeners).Bundle with a Laravel Service Provider to register Doctrine types and console commands.make:rule-engine as a custom command (e.g., php artisan make:rule).Event facade or Laravel Queues for async rule execution.TriggerEvent to a Laravel RuleEvaluated event.DiscountRule) and test CRUD + evaluation.order.created → apply discount).RuleCompiler service).ConditionsType → PHP array).// In RuleModel.php
protected $casts = [
'conditions' => 'array',
'action' => 'array',
];
make:rule-engine with a Laravel command that generates Eloquent models instead of Symfony entities.Mockery or Pest to mock rule conditions/actions in unit tests.config/app.php to auto-load the bundle (or manually register the provider).php artisan doctrine:migration (if using DBAL) or create a custom migration for Eloquent.RuleEngine facade/service to wrap package methods.// app/Services/RuleEngine.php
class RuleEngine {
public function evaluate(Rule $rule, array $context) {
return (new \DrinksIt\RuleEngineBundle\RuleEvaluator())
->evaluate($rule->conditions, $rule->action, $context);
}
}
event(new OrderCreated($order))).drinks-it/rule-engine for updates (low-starred package = higher risk of breaking changes).composer.json to avoid surprises.version field to rules to handle schema evolution.RuleDebugger service to log intermediate states.rule:{id}, TTL: 1 hour).RuleEvaluatorJob).DiscountRules, AccessRules) to limit evaluation scope.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Doctrine type deserialization | Rule evaluation crashes | Fallback to JSON storage + validation |
| Event dispatch failure | Rules never trigger | Retry queue + dead-letter channel |
| Circular rule dependencies | Infinite loops | Depth tracking + max recursion limit |
| Database connection issues | Rule storage fails | Queue delayed retries |
| Malformed rule data | Runtime errors | Schema validation on rule creation |
php artisan make:rule for faster development.How can I help you explore Laravel packages today?