PHPackages                             league/container - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. league/container

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

league/container
================

A fast and intuitive dependency injection container.

5.2.0(2mo ago)86787.8M—5%105[5 issues](https://github.com/thephpleague/container/issues)20MITPHPPHP ^8.1CI passing

Since Jan 12Pushed 1mo ago19 watchersCompare

[ Source](https://github.com/thephpleague/container)[ Packagist](https://packagist.org/packages/league/container)[ Docs](https://github.com/thephpleague/container)[ GitHub Sponsors](https://github.com/philipobenito)[ RSS](/packages/league-container/feed)WikiDiscussions 6.x Synced 1mo ago

READMEChangelog (10)Dependencies (17)Versions (52)Used By (20)

Container (Dependency Injection)
================================

[](#container-dependency-injection)

[![Author](https://camo.githubusercontent.com/f2e126954eb8a158735b338db05e8e66de0876fc1d1b84cec49928762e90c44b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d5068696c25323042656e6e6574742d626c75653f7374796c653d666c61742d737175617265)](https://github.com/philipobenito)[![Latest Version](https://camo.githubusercontent.com/d7b621ac09de466a56e6b0659db37f975645bb37f2386ea9a7fc50cdd58457e4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7468657068706c65616775652f636f6e7461696e65722e7376673f7374796c653d666c61742d737175617265)](https://github.com/thephpleague/container/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/41da753bbc6bc0d2cd4c7e9995f1ed56f060ec9d75b1df3a7d7af9edde7901fd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7468657068706c65616775652f636f6e7461696e65722f746573742e796d6c3f7374796c653d666c61742d737175617265)](https://github.com/thephpleague/container/actions/workflows/test.yml)[![Total Downloads](https://camo.githubusercontent.com/6414bdb113ddcf83f5176eee7b2895aeb7aae7b0eb84de318e966e942474c52d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c65616775652f636f6e7461696e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/league/container)

This package is compliant with [PER-CS](https://www.php-fig.org/per/coding-style/), [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md) and [PSR-11](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md). If you notice compliance oversights, please send a patch via pull request.

Install
-------

[](#install)

Via Composer

```
composer require league/container
```

Requirements
------------

[](#requirements)

This version supports the following versions of PHP.

- PHP 8.3
- PHP 8.4
- PHP 8.5

Documentation
-------------

[](#documentation)

Container has [full documentation](http://container.thephpleague.com), powered by [Jekyll](http://jekyllrb.com/).

Contribute to this documentation in the [docs/](https://github.com/thephpleague/container/tree/master/docs) subdirectory.

Testing
-------

[](#testing)

Testing includes Pest and PHPStan (Level 8).

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/thephpleague/container/blob/master/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Phil Bennett](https://github.com/philipobenito)
- [All Contributors](https://github.com/thephpleague/container/contributors)
- `Orno\Di` contributors

License
-------

[](#license)

The MIT Licence (MIT). Please see [Licence File](https://github.com/thephpleague/container/blob/master/LICENSE.md) for more information.

###  Health Score

78

—

ExcellentBetter than 100% of packages

Maintenance88

Actively maintained with recent releases

Popularity76

Solid adoption and visibility

Community53

Growing community involvement

Maturity85

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 72.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~80 days

Total

52

Last Release

59d ago

Major Versions

3.4.0 → 4.0.02021-07-09

3.x-dev → 4.1.02021-07-09

4.2.4 → 5.0.02025-03-27

4.2.5 → 5.1.02025-05-28

5.x-dev → 6.x-dev2026-03-20

PHP version history (8 changes)1.0.0PHP &gt;=5.4.0

2.3.0PHP ^5.4.0 || ^7.0

3.0.0PHP ^7.0

3.3.2PHP ^7.0 || ^8.0

2.5.0PHP ^5.4 || ^7.0 || ^8.0

4.0.0PHP ^7.2 || ^8.0

5.0.0PHP ^8.1

6.x-devPHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/be6d3979e325bfabb0b44a688ecd4b064381dcfd1b6facca14c88e17684ec0f2?d=identicon)[philipobenito](/maintainers/philipobenito)

---

Top Contributors

[![philipobenito](https://avatars.githubusercontent.com/u/2077289?v=4)](https://github.com/philipobenito "philipobenito (308 commits)")[![localheinz](https://avatars.githubusercontent.com/u/605483?v=4)](https://github.com/localheinz "localheinz (38 commits)")[![hannesvdvreken](https://avatars.githubusercontent.com/u/1410358?v=4)](https://github.com/hannesvdvreken "hannesvdvreken (9 commits)")[![azjezz](https://avatars.githubusercontent.com/u/29315886?v=4)](https://github.com/azjezz "azjezz (7 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (6 commits)")[![ADmad](https://avatars.githubusercontent.com/u/142658?v=4)](https://github.com/ADmad "ADmad (6 commits)")[![jenssegers](https://avatars.githubusercontent.com/u/194377?v=4)](https://github.com/jenssegers "jenssegers (5 commits)")[![M1ke](https://avatars.githubusercontent.com/u/1226123?v=4)](https://github.com/M1ke "M1ke (5 commits)")[![philsturgeon](https://avatars.githubusercontent.com/u/67381?v=4)](https://github.com/philsturgeon "philsturgeon (4 commits)")[![Art4](https://avatars.githubusercontent.com/u/2162994?v=4)](https://github.com/Art4 "Art4 (3 commits)")[![DannyvdSluijs](https://avatars.githubusercontent.com/u/618940?v=4)](https://github.com/DannyvdSluijs "DannyvdSluijs (3 commits)")[![arai-ta](https://avatars.githubusercontent.com/u/22699542?v=4)](https://github.com/arai-ta "arai-ta (3 commits)")[![greg-1-anderson](https://avatars.githubusercontent.com/u/612191?v=4)](https://github.com/greg-1-anderson "greg-1-anderson (3 commits)")[![chrisguitarguy](https://avatars.githubusercontent.com/u/1010392?v=4)](https://github.com/chrisguitarguy "chrisguitarguy (2 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (2 commits)")[![sagikazarmark](https://avatars.githubusercontent.com/u/1226384?v=4)](https://github.com/sagikazarmark "sagikazarmark (2 commits)")[![mehdihasanpour](https://avatars.githubusercontent.com/u/47119405?v=4)](https://github.com/mehdihasanpour "mehdihasanpour (2 commits)")[![pascal-hofmann](https://avatars.githubusercontent.com/u/2102878?v=4)](https://github.com/pascal-hofmann "pascal-hofmann (2 commits)")[![andypost](https://avatars.githubusercontent.com/u/73713?v=4)](https://github.com/andypost "andypost (2 commits)")[![sobhanlori](https://avatars.githubusercontent.com/u/26341429?v=4)](https://github.com/sobhanlori "sobhanlori (1 commits)")

---

Tags

dependency-injectionphpcontainerdependencyinjectionleaguediserviceprovider

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/league-container/health.svg)

```
[![Health](https://phpackages.com/badges/league-container/health.svg)](https://phpackages.com/packages/league-container)
```

###  Alternatives

[capsule/di

A PSR-11 compliant autowiring dependency injection container.

2857.5k2](/packages/capsule-di)[miladrahimi/phpcontainer

Dependency injection (IoC) container for PHP projects

1322.7k2](/packages/miladrahimi-phpcontainer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
