yiisoft/factory
A flexible factory for Yii3 that creates objects from class names, definitions, or callables, resolving constructor dependencies through a PSR-11 container. Ideal for configurable services and dependency injection setups.
Consider it when:
Illuminate\Container or Symfony's container.Look elsewhere when:
app()->make() and Laravel's container already do reflection-based autowiring, contextual binding, and attribute-driven injection. Adding this creates a second DI path with no upside.To executives: This is a small, permissively licensed (BSD-3) utility from the Yii project that helps construct PHP objects using standard container interfaces. It carries negligible cost and low risk, but also low leverage — our adoption signal (36 stars, weak opportunity score) says it will not move business metrics. Recommendation: do not fund adoption as an initiative. Sanction it only as an allowed dependency for framework-agnostic libraries, where it replaces bespoke glue code with a maintained standard.
To engineering: It is a reflection-based factory that resolves constructor dependencies from any PSR-11 container — conceptually the autowiring half of Laravel's container, minus bindings, providers, and lifecycle. In a Laravel codebase it is redundant and should be rejected; maintain one DI path. In shared libraries or non-Laravel services, it is a clean, dependency-light seam that keeps you off Illuminate\Container. Caveats: small maintainer base, no advanced DI features, and an implicit expectation that you own the integration. Approve for library code with a clear owner; block for application code.
How can I help you explore Laravel packages today?