# PHP-DI

> The dependency injection container for humans

Source: https://talira.ai/catalog/php-di-gbzc2k11
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [libraries / dependency injection](https://talira.ai/categories/libraries/dependency-injection), [languages / php](https://talira.ai/categories/languages/php)
- Licence: MIT[^3]
- Pricing: Free and open source[^2]
- Free tier: yes[^2]
- Supports: [PSR-11](https://talira.ai/standards/psr-11.md)[^4]
- Backed by: [Matthieu Napoli](https://talira.ai/orgs/matthieu-napoli.md)

PHP-DI is a dependency injection container for PHP meant to be practical, powerful and framework-agnostic. It wires objects together by autowiring, PHP definition files and attributes, supports definition overriding, lazy injection and injecting into existing instances, and implements the PSR-11 container interface. Its documentation covers integrations with [Symfony](https://talira.ai/catalog/symfony-e514zcgt.md), [Slim](https://talira.ai/catalog/slim-bqppx9j7.md) and other frameworks.

## Links

- Website: https://php-di.org/
- GitHub: https://github.com/PHP-DI/PHP-DI
- Docs: https://php-di.org/doc/

## Problems it solves

- wire up dependencies in my PHP app without a big framework
- add a dependency injection container to a Slim app
- autowire constructor dependencies in PHP

## Features

- autowiring of constructor dependencies
- PHP definition files and attribute-based injection
- definition extensions and overriding
- lazy injection and injection into existing instances
- implements the PSR-11 container interface
- documented integrations with Symfony, Slim and other frameworks

## Limitations

- Needs PHP 8.0 or later.[^1]

## Trust

Overall: 0.40 out of 1.
Signals: maintenance 0.27, adoption 0.69, momentum 0.37, community 0.83, backing 0.30, extensibility 0.00.

- latest release 7.1.1 15 months ago
- 2.8k GitHub stars
- 116 contributors
- accepts sponsorship (Github, Tidelift)
- backed by Matthieu Napoli

Warnings:

- last commit 11 months ago

## Alternatives

- [laminas-servicemanager](https://talira.ai/catalog/laminas-servicemanager-cc833v26.md): A factory-driven dependency injection container for PHP from the Laminas Project
- [Pimple](https://talira.ai/catalog/pimple-ws39w9n2.md): Small dependency injection container for PHP

## Sources

[^1]: https://github.com/PHP-DI/PHP-DI/blob/master/composer.json (checked 28 Nov 2026)
[^2]: https://github.com/PHP-DI/PHP-DI/blob/master/doc/README.md (checked 28 Nov 2026)
[^3]: https://github.com/PHP-DI/PHP-DI/blob/master/LICENSE (checked 28 Nov 2026)
[^4]: https://github.com/PHP-DI/PHP-DI/blob/master/doc/container.md (checked 28 Nov 2026)
