mouf/picotainer
Picotainer is a tiny (24 lines) dependency injection container for PHP, inspired by Pimple and compatible with container-interop/PSR-11. Define entries as closures, support delegate lookup, and retrieve services with a minimalist API.
php-di/php-di or league/container.singleton(), tag(), context binding, or facades).*"Picotainer is a 24-line, zero-dependency DI container that gives us the flexibility to decouple Laravel’s monolithic container for specific use cases—like CLI tools, queues, or legacy systems—without reinventing the wheel. By adopting this, we:
The trade-off is minimal maintenance (last updated in 2017), but the risk is mitigated by its simplicity and our ability to isolate usage to non-critical paths. For example, we could use Picotainer for our nightly report generator (a CLI tool) while keeping Laravel’s container for the web app. This approach lets us test the waters with low risk."*
*"Picotainer is a minimalist PSR-11 container that lets us:
Prototype Plan:
Risks to Watch:
singleton(), tag()), so we’ll need workarounds.Alternatives:
php-di/php-di (more features, but heavier).Let’s dogfood it in the report generator first to validate the trade-offs."*
How can I help you explore Laravel packages today?