Download the PHP package bitexpert/disco without Composer
On this page you can find all versions of the php package bitexpert/disco. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package disco
bitexpert/disco
This package provides a PSR-11 compatible, annotation-based dependency injection container. Have a look at the disco-demos project to find out how to use Disco.
Installation
The preferred way of installing bitexpert/disco
is through Composer.
You can add bitexpert/disco
as a dependency, as follows:
Usage
To instantiate Disco use the following code in your bootstrapping logic.
Create an instance of the \bitExpert\Disco\AnnotationBeanFactory
and register the instance with the \bitExpert\Disco\BeanFactoryRegistry
.
The second step is important as Disco needs to grab the active container instance in a few locations where it does not have access to the container instance itself.
Next up you need to create a configuration class MyConfiguration
and document it with a @Configuration
annotation.
To declare a configuration entry, 1) add a method to your MyConfiguration
class, and 2) annotate the method with the @Bean
annotation.
Doing this registers the instance with Disco and uses the type specified by the method’s return value. The primary identifier is the method name:
To let Disco return the entry with the id mySampleService
call the get()
method of \bitExpert\Disco\AnnotationBeanFactory
, as follows:
Documentation
Documentation is bookdown.
Then point your browser to http://localhost:8080/
Contribute
Please feel free to fork and extend existing or add new features and send a pull request with your changes! To establish a consistent code quality, please provide unit tests for all your changes and adapt the documentation.
Want To Contribute?
If you feel that you have something to share, then we’d love to have you. Check out the contributing guide to find out how, as well as what we expect from you.
Resources
- sitepoint.com: Disco with Design Patterns: A Fresh Look at Dependency Injection
- php[architect]: Education Station: Your Dependency Injection Needs a Disco
- Presentation: Disco - A Fresh Look at DI at PHPUGFFM V/2016
License
Disco is released under the Apache 2.0 license.
All versions of disco with dependencies
psr/container Version ^1.0.0
doctrine/annotations Version ^1.3.0
ocramius/proxy-manager Version ^2.2.0
bitexpert/slf4psrlog Version ^0.1.3