mouf/utils.common.conditioninterface
A small PHP utility from the Mouf framework that defines a ConditionInterface: a simple contract requiring a single method to evaluate whether a condition is met. Implement it to build reusable, composable conditions that can be checked uniformly across your application code.
ConditionInterface (isOk(): bool) plus composites like AndCondition and OrCondition. That is the entire product surface — roughly a day of internal engineering. The decision it informs is therefore less "should we adopt this" and more "should we formalize a shared predicate contract at all, and is this the shape we want?"symfony/expression-language instead.PM read: the opportunity score (41.43) and score (0.015) point the same direction — the idea of a condition contract is mildly interesting, the artifact is not. Treat this as prior art for a design doc, not a line item in the dependency manifest.
Consider it if:
ConditionInterface so independently developed packages can compose conditions without a common base class.isOk) that other teams can adopt cheaply.Look elsewhere — or write the interface yourself — if:
Illuminate\Support\Traits\Conditionable (when/unless), Illuminate\Validation\Rule objects, Gates/Policies, and pipelines cover most of the same ground with first-class support, testing, and documentation. Adding a 3-star PHP 5-era package to a modern Laravel app is a net negative for onboarding and code review.symfony/expression-language, a rules engine (e.g., nikic/php-parser-based or JSON-logic ports), or a dedicated feature-flag service. This package has no parser, no serialization, and no evaluation context — every condition is a hand-written class.isOk() takes no arguments, so context must be injected via constructor — workable, but it forces a container wiring decision per rule and makes conditions stateful in ways that complicate caching and testing.composer.json, a lockfile diff, and a future migration. The correct PM call is usually: copy the ~30 lines, attribute the MIT license, own it internally.NotCondition, XorCondition, or short-circuit guarantees. Verify against the actual source before committing; the description promises only And/Or, and composite semantics (evaluation order, exception propagation) are not documented.Adoption bar I'd set: the package must save more than one engineer-day of work and must not be the only thing standing between you and a framework-native solution. On current evidence, it clears neither.
For executives (30 seconds):
This is a tiny, MIT-licensed PHP utility that defines a standard "yes/no rule" interface so that conditions can be combined — all of these must be true or any of these must be true. It is not a platform, not a service, and not a dependency we'd build a roadmap on. Value: it names a pattern our product already uses informally (eligibility checks, feature gating, discount rules). Recommendation: do not adopt as a dependency; instead, cite it as prior art and, if we need the contract, own a five-line internal interface. Cost to replicate: negligible. Risk of adopting: an unmaintained, three-star package with no downstream users and no release since 2019 in our lockfile for no measurable benefit.
For engineering (the actual ask):
If we find ourselves writing a third independent
if ($a && ($b || $c))gate, we should introduce a sharedConditioncontract withisOk(): boolandAnd/Or/Notcomposites. This package is the minimal reference for that shape — MIT, framework-agnostic, ~30 lines. We should vendor the pattern, not the package: put it inapp/Support/Conditionswith a test for composite short-circuiting and a rule that conditions are constructor-injected and side-effect free. If we ever need admin-authored rules, that's a separate evaluation (symfony/expression-languageor a rules engine) and this package won't get us there — flag it early so we don't over-invest in hand-written condition classes.
How can I help you explore Laravel packages today?