container README

The project's README from github.com/php-fig/container. As one markdown file: README.md.

Container interface

This repository holds all interfaces related to PSR-11 (Container Interface).

Note that this is not a Container implementation of its own. It is merely abstractions that describe the components of a Dependency Injection Container.

The installable package and implementations are listed on Packagist.

container (php-fig/container)

Searching Database…

What is this?The official PHP-FIG repository of interfaces for PSR-11, the Container Interface standard. It defines the abstractions that describe the components of a Dependency Injection Container.
So is this an actual dependency injection container I can run my code through?No — it ships only PHP interfaces, not a working container. You depend on the standard, and your application plugs in whichever PSR-11-compliant container it prefers.
How do I get it into a PHP project?Add it with Composer from Packagist, where both the installable package and the list of container implementations are linked.
Do I need anything else alongside it?Just PHP and Composer — the package is interfaces only and carries no runtime dependencies. To actually resolve services you additionally install a concrete PSR-11 container implementation.
What is the main thing it will not do for me?It cannot create or fetch any services on its own — with only these interfaces installed, nothing happens until you pick a real container that implements them.
Is this meant for application developers or library authors?Mostly library authors: coding against these interfaces keeps a library container-agnostic, while the end application is the one that chooses and configures a concrete implementation.
What exactly is PSR-11?PSR-11 is the PHP-FIG standard for dependency injection containers: a common set of interfaces any container can implement. This repository holds those official interfaces, so code can request services without caring which container is behind them.
Why would a library depend on this instead of a concrete container?Because the interface keeps it vendor-neutral. A library written against PSR-11 works with any compliant container the application already uses, instead of forcing one specific dependency injection implementation on everyone.
Which containers actually implement these interfaces?The README does not name any — it just links to a list of implementations on Packagist, where the PSR-11-compliant containers are cataloged.
Creator
php-fig
Size
0.3 MB
Stars
10K
Age
10y
Commits · 90 Days