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.
singleton() lets a team standardize on one container for DB connections, HTTP/API clients, and loggers instead of hand-rolling memoized closures or global registries in each service. This makes a "use a small container, skip a full framework" decision more defensible.flight\Container) — a standalone, framework-agnostic DI container, not a Laravel package. If the roadmap question is "do we stay on Laravel's container or adopt a portable one," this release is evidence the portable option now covers the singleton/instance-sharing baseline that Laravel's singleton()/instance() has offered for years. It does not justify migrating off Laravel's container on capability grounds alone.set()->singleton()->set() reduces bootstrap boilerplate, which is a real onboarding and code-review cost on greenfield services. Minor, but it's the kind of thing that shortens service scaffolding.Consider it when:
Look elsewhere when:
singleton, scoped, instance, interface binding, contextual binding, and Octane-aware lifecycle handling. Adding a second container creates two sources of truth for object lifetime — a genuine maintenance and debugging tax.Assessment caveat: these notes describe only the delta from v1.1.0. Before adopting, validate the baseline: PSR-11 compliance, autowiring behavior, exception types, PHP version floor, and test-isolation story.
For executives (one line): A small, focused update to a lightweight PHP dependency-injection container that now supports shared instances of database connections, API clients, and loggers — removing a common reason teams reach for a heavier framework. Low risk, no breaking changes, relevant only if we choose a non-Laravel stack.
For engineering:
singleton() for both class names and pre-built objects, plus fluent chaining on the container.Recommendation: Do not change course based on this release alone. If we are on Laravel, stay on Laravel's container — the overlap creates ambiguity about object lifetime and adds a second wiring convention for no capability gain. If we have a non-Laravel service or CLI tool where a minimal container is the right size, this release makes flightphp/container a viable candidate; run a short spike validating PSR-11 conformance, autowiring expectations, and test-isolation behavior before adopting.
How can I help you explore Laravel packages today?