flightphp/container
A lightweight PSR-11 dependency injection container built for the Flight PHP micro-framework, offering simple service binding, lazy resolution, and constructor injection without the overhead of heavier container libraries.
Architecture fit
flightphp/container) is a standalone PSR-style DI container from the Flight micro-framework ecosystem, not a Laravel package. Laravel ships its own container with equivalent and richer semantics (singleton(), bind(), instance(), contextual binding, tagging, deferred providers).set()/singleton() chain. No removals or signature breaks are described.Integration feasibility
singleton($classOrObject, ?Closure $factory)) — trivial to trial in an isolated spike.singleton(SomeClass::class) where the target has constructor dependencies — the only documented example (DateTimeImmutable) is no-arg, so this is unproven.Container::set() delegation is not stated, so a shared-container bridge would need custom glue.Technical risk
get() vs. eager at registration). This drives correctness in long-running processes.singleton($existingObject)) binds an already-constructed instance — anything it holds (sockets, PDO handles, open file streams) is retained for process lifetime.Key questions
singleton(Foo::class) autowire constructor dependencies, or require an explicit factory closure?get()?forget() / flush() / container-reset mechanism for long-running workers and test isolation?singleton() returning $this alter any prior return contract relied on by existing call sites (verify against v1.1.0)?Stack fit
app()->singleton() / app()->instance(); the parity is direct and you avoid a second container. Rationale should be recorded so the package isn't re-proposed.ServiceRegistry wrapper) so the concrete container is swappable.flight\Container.Migration path
Compatibility
^1.2 and treat minor bumps as reviewable, given the small maintainer surface.Sequencing
Maintenance
league/container or PSR-11 equivalents at low cost.Support
singleton() behavior. Capture it in the spike write-up.Scaling
--max-jobs) becomes the de facto isolation mechanism — plan for it explicitly rather than by accident.Failure modes
singleton(Foo::class) without a factory, where autowiring is unsupported, fails at get() time rather than at registration — late, harder-to-trace failures.Ramp-up
flight\Container imports in Laravel application namespaces.How can I help you explore Laravel packages today?