# PHP-DI/PHP-DI

The dependency injection container for humans

Repository: https://github.com/PHP-DI/PHP-DI
Canonical: https://ross.abutalabs.com/products/php-di
Homepage: https://php-di.org
Language: PHP
License: MIT
License Family: permissive
Topics: php, dependency-injection, ioc, psr-11, container-interop
Last push: 2025-12-31T13:02:25+00:00

## Health v2 (maintenance only)
Score: 58/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 60, release rhythm 31, longevity 100
- inputs: {"age_days": 5282, "days_push": 245, "days_rel": 382, "gap_med": 41, "n_releases_24m": 6}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2772, forks 320 (observed 2026-08-28T04:07:19.050787+00:00)

## What it is
PHP-DI is a dependency injection container for PHP that emphasizes practicality, autowiring, and expressive PHP-based configuration. It is framework-agnostic, PSR-11 compliant, and supports container compilation for production performance.

## Use cases
- manage dependency injection in a PHP application
- autowire classes from constructor type-hints
- bind interfaces to implementations in a service container
- replace Pimple or another PSR-11 container
- configure services with PHP-based definitions instead of YAML or XML
- integrate a DI container with Slim or Symfony

## When to choose
- you want a PSR-11 compliant container with zero-config autowiring
- you prefer configuration written in PHP with IDE autocompletion and static analysis
- you need a framework-agnostic container that scales from small apps to modular systems
- you want compiled containers for optimal production performance

## When to avoid
- your framework already ships with its own DI container you are happy with
- you need dependency injection in a non-PHP project
- you are on PHP below 8.0 (PHP-DI 7 requirement)

## Facets
- artifact type: library
- maturity: stable
- function: middleware, developer-tools
- domain: web-development, backend, developer-tools
- platform: php
- tags: dependency-injection, ioc-container, psr-11, autowiring, service-container

## Member repositories
- PHP-DI/PHP-DI (main) score 58

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:19.050787+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T08:16:37.224332+00:00, confidence not recorded.
  - readme: https://github.com/PHP-DI/PHP-DI (fetched 2026-08-28T04:07:19.050787+00:00, sha dce0997cd472)
  - homepage: https://php-di.org (fetched 2026-08-29T09:55:59.863240+00:00, sha 10b523965e9e)
  - site_page: https://php-di.org/doc/getting-started.html (fetched 2026-08-29T09:55:59.872089+00:00, sha 0523653bb300)
  - site_page: https://php-di.org/doc (fetched 2026-08-29T09:55:59.873991+00:00, sha 07b604423705)
  - site_page: https://php-di.org/change-log.html (fetched 2026-08-29T09:55:59.875503+00:00, sha 05a22684ec1e)
- Data as of 2026-08-30T08:39:29.467469+00:00.
