Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. PHP
  3. Container

Container

MITPHP5.2.0

A small but powerful PSR-11 compliant dependency injection container for PHP applications.

Visit WebsiteGitHubGitHub
868 stars105 forks0 contributors

What is Container?

Container is a dependency injection container for PHP that manages class dependencies and implements the PSR-11 standard. It provides a standardized way to handle object creation and dependency resolution in PHP applications, promoting loose coupling and testable code. The container supports autowiring, service providers, and delegation while maintaining a lightweight footprint.

Target Audience

PHP developers building applications that benefit from dependency injection, particularly those working with frameworks or libraries that follow PSR standards. It's ideal for developers who want a standardized, interoperable container solution.

Value Proposition

Developers choose Container because it's PSR-11 compliant, ensuring compatibility with other PHP-FIG standards, while remaining small and focused. It provides essential dependency injection features without the complexity of larger framework-specific containers.

Overview

Small but powerful dependency injection container

Use Cases

Best For

  • Implementing dependency injection in PSR-compliant PHP applications
  • Managing service dependencies in modular PHP architectures
  • Creating testable PHP code with loose coupling
  • Building interoperable PHP libraries that require dependency injection
  • Migrating from framework-specific containers to standards-based solutions
  • Setting up service providers for organized dependency management

Not Ideal For

  • Projects already using a full-stack PHP framework with a mature DI container, such as Laravel or Symfony, where switching adds integration complexity with little benefit.
  • Simple CLI scripts or small web applications where dependency injection introduces unnecessary abstraction and performance overhead.
  • Teams requiring extensive out-of-the-box integrations with third-party libraries or graphical tools for dependency management.

Pros & Cons

Pros

PSR Standards Compliance

Implements PSR-11 ContainerInterface, ensuring seamless interoperability with other PHP-FIG compliant components, as highlighted in the README's compliance notes.

Flexible Service Definitions

Supports autowiring, manual configuration, and various definition methods, allowing for both convention-over-configuration and explicit control based on project needs.

Modular Service Providers

Enables organization of service definitions into reusable provider classes, promoting clean separation of concerns and easier maintenance in large applications, as mentioned in the key features.

Delegation Support

Facilitates complex dependency hierarchies by allowing containers to delegate resolution to other containers, ideal for microservices or modular architectures.

Cons

Manual Configuration Overhead

Unlike framework-integrated DI containers, it requires developers to set up and configure everything from scratch, which can be time-consuming for new or rapid-prototyping projects.

Limited Ecosystem and Tooling

As a standalone library, it lacks the extensive community plugins, IDE integrations, and graphical management tools available with framework-specific containers like those in Laravel or Symfony.

Documentation Reliance

Full documentation is hosted separately and must be referenced externally, which might not always be as up-to-date or integrated as inline documentation in larger frameworks.

Frequently Asked Questions

Quick Stats

Stars868
Forks105
Contributors0
Open Issues5
Last commit3 months ago
CreatedSince 2015

Tags

#psr-11#dependency-injection#inversion-of-control#autowiring#service-container#php#composer-package

Built With

P
PHPStan
P
Pest
P
PHP

Links & Resources

Website

Included in

PHP32.5k
Auto-fetched 53 minutes ago

Related Projects

Symfony DISymfony DI

Allows you to standardize and centralize the way objects are constructed in your application

Stars4,169
Forks91
Last commit4 days ago
AurynAuryn

IoC Dependency Injector

Stars724
Forks63
Last commit1 year ago
Aura.DiAura.Di

Dependency Injection System

Stars352
Forks63
Last commit15 days ago
AcclimateAcclimate

Adapters for PHP framework containers to an interoperable interface

Stars220
Forks17
Last commit2 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub