mouf/utils.value.value-interface
A tiny PHP package from Mouf that defines the ValueInterface contract for objects exposing a value through getValue(). It provides a simple, reusable abstraction for value wrappers and dependency-injection-friendly components.
Architecture fit
Mouf\Utils\Value, one method returning the computed value). It is framework-agnostic, dependency-free, and carries no runtime behavior — it slots into any layer (Domain, Application, Infrastructure) without violating Laravel conventions.Illuminate\Support\LazyCollection, the value() helper, Illuminate\Contracts\Support\Arrayable/Jsonable contracts, and PHP 8 first-class callables. The package's only marginal gain is a named, type-hintable contract for deferred values — real but modest.Integration feasibility
composer require mouf/utils.value.value-interface. No service provider, no config publish, no migrations, no facade. Integration cost is effectively zero.composer.json PHP constraint, autoload mapping (PSR-0 vs PSR-4), and the exact method signature (val() vs getValue()) before writing type hints across the codebase.Technical risk
composer.json pins php: >=5.x without an upper bound or conflicts with modern constraints, it can block a PHP 8.2/8.3 upgrade — a hard, non-negotiable blocker.Key questions
Closure + docblocks satisfy 90% of cases?value() semantics?Stack fit
Migration path
App\Support\Value\ValueInterface with the same single-method contract. If we later adopt the third-party package, add a thin adapter class implementing both. This gives a clean exit ramp and removes the abandoned-dependency risk at the cost of ~10 lines of code.Compatibility
composer audit / dependency-review tooling does not flag it as abandoned in a way that blocks CI.Sequencing
Maintenance
Support
Scaling
ValueInterface implementation wraps a database or HTTP call without memoization, and callers invoke it inside loops or Blade partials, you get silent N+1 queries that are hard to trace because the call site reads like a property access.Failure modes
composer.json.Ramp-up
Recommendation: Adopt the pattern, not the dependency. Define a 10-line internal interface, keep the third-party package out of the dependency graph, and revisit only if a maintained, widely-adopted implementation emerges. A 0.005 score with 1 star and 0 dependents is the signal, not the interface design.
How can I help you explore Laravel packages today?