A PSR-11 compatible, annotation-based dependency injection container for PHP.
Disco is a dependency injection container for PHP that is compatible with the PSR-11 standard. It uses annotations to define and configure services, providing a structured and type-safe way to manage object dependencies in PHP applications.
PHP developers building applications that require a standardized, annotation-based dependency injection container, particularly those working in teams or projects that value PSR compliance and type safety.
Developers choose Disco for its adherence to PSR-11, its clean annotation-based configuration that reduces boilerplate code, and its focus on type safety, making dependency management more reliable and maintainable.
PSR-11 compatible Dependency Injection Container for PHP.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Implements the standard container interface, ensuring seamless interoperability with other PSR-11 libraries, as highlighted in the key features.
Uses @Configuration and @Bean annotations to define services directly in PHP classes, reducing boilerplate and keeping configuration code clean and centralized.
Leverages PHP return type declarations in configuration methods to enforce type safety, making dependency management more reliable and less error-prone.
Registers beans via methods in configuration classes with method names as identifiers, providing a clear and organized approach to service definition.
Requires registering the container instance with BeanFactoryRegistry, introducing global state that can complicate testing, modularity, and container isolation.
Documentation is stored separately and must be compiled using bookdown, adding an extra step for users to access comprehensive guides, as noted in the README.
Annotation-based configuration is static and compiled, making it less flexible for dynamic or environment-specific settings without manual workarounds or additional classes.