elcodi/rule-bundle
Rule Bundle is part of Elcodi, an e-commerce suite of Symfony components and bundles under MIT license. It provides a flexible rules engine for defining conditions and actions in your store. Note: read-only package; use the main elcodi/elcodi repo for issues, questions, and pull requests.
Architecture fit. elcodi/rule-bundle is a Symfony bundle, not a Laravel package. Its value proposition — persistable rules composed of conditions and actions, evaluated against a domain context — is exactly the abstraction a TPM wants when scoping promotions, coupons, shipping, or pricing logic. But the deliverable is not the concept; it is Symfony-specific packaging: a bundle class, DI extension, compiler passes, YAML/XML service wiring, Doctrine entity mappings, and event subscribers. None of that boots under a Laravel kernel. Conceptually aligned with a Laravel commerce roadmap; architecturally misaligned with a Laravel runtime.
Integration feasibility. Two routes exist and only one is durable.
Composer reality check: this is a Symfony 2.x/3.x-era artifact. Laravel 10/11 pins Symfony 6/7. Constraint conflicts are near-certain, and Elcodi's own transitive pins (Doctrine, PHP floor) will compound them. Route 1 likely fails at composer require before it fails at runtime.
Technical risk. High, and stacked rather than singular.
Key questions.
symfony/expression-language directly in Laravel and skip most of the fork.composer.json constraints on symfony/*, doctrine/*, and php?Stack fit. Poor as-shipped. The pragmatic baseline for a Laravel app is symfony/expression-language over Eloquent models with our own rule/condition/action tables. Only pursue Elcodi's model if its semantics are materially richer — rule groups, precedence rules, typed context contracts — than that baseline. Assume they are not until proven otherwise by reading the core.
Migration path. Fork the subtree into an internal path-repository package (e.g. packages/rule-engine). Strip the bundle class and DI extension; port service definitions to a Laravel service provider with publishable config. Replace Doctrine repositories with Eloquent, or keep Doctrine DBAL if the rule persistence schema is already clean and stable. Preserve the evaluation core verbatim through the port so behavior can be diffed against the original in characterization tests.
Compatibility. Audit composer.json before writing a line of code. Expect Symfony 2.x/3.x pins, a PHP floor below 8.x, and Doctrine versions Laravel no longer tolerates. Check for each(), mcrypt, dynamic properties (PHP 8.2 deprecation), and legacy Doctrine query APIs. Budget an explicit modernization pass: typed properties, return types, null-safe operators, and a PHPUnit suite we author ourselves since none ships in this artifact.
Sequencing.
Maintenance. We own it fully and permanently. Read-only upstream plus a dormant project means no bug fixes, no security patches, no PHP/Symfony version support from anyone but us. Every PHP minor upgrade becomes a fork-rebase exercise. Price this into the build-vs-adopt comparison honestly — it is the dominant ongoing cost.
Support. The referenced Gitter, StackOverflow, and Twitter channels are stale; there is no maintainer, no SLA, and no escalation path. Every issue is an internal ticket assigned to whoever owns the fork. This is acceptable only if that owner is named before adoption, not after the first pricing bug.
Scaling. Rule evaluation sits in the request path during cart, checkout, and pricing — the worst possible place for latency surprises. Watch for: N+1 rule loading from persistence, repeated expression parsing on every request, and unbounded rule-set growth as merchandisers add promotions. Mitigate with compiled-rule caching keyed by rule version, per-context memoization, and benchmarks at realistic rule counts (hundreds, not tens) before go-live.
Failure modes.
Mitigation: make fail-open vs. fail-closed an explicit, tested policy per rule category; log every evaluation error with rule ID, context hash, and outcome; and add a circuit breaker so a rule engine failure degrades to last-known-good pricing rather than blocking checkout.
Ramp-up. Moderate for a competent Laravel team, higher than the code size suggests. The rule model itself is compact, but unpacking Symfony-era idioms and implicit Elcodi domain assumptions costs real time. Expect roughly 1–2 sprint-weeks for spike plus extraction, extending meaningfully if persistence is ported and PHP 8 modernization is required. Symfony DI familiarity helps conceptually and does not transfer cleanly to Laravel's container idioms.
TPM recommendation. Do not adopt this bundle as a runtime dependency in a Laravel application. Use it as reference architecture: spend a day reading the rule/condition/action decomposition, then design a minimal framework-agnostic engine on symfony/expression-language with Eloquent-backed persistence, owned internally. Revisit only if Elcodi revives with active maintenance and modern framework constraints, or if a maintained Laravel-native rules engine emerges.
How can I help you explore Laravel packages today?