Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bitExpert/disco
PSR-11 compatible Dependency Injection Container for PHP.
https://github.com/bitExpert/disco
container-interop dependency-injection dependency-injection-container disco php psr-11
Last synced: 4 days ago
JSON representation
PSR-11 compatible Dependency Injection Container for PHP.
- Host: GitHub
- URL: https://github.com/bitExpert/disco
- Owner: bitExpert
- License: apache-2.0
- Created: 2015-11-01T19:11:18.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2024-04-06T09:09:19.000Z (7 months ago)
- Last Synced: 2024-11-08T02:49:16.685Z (4 days ago)
- Topics: container-interop, dependency-injection, dependency-injection-container, disco, php, psr-11
- Language: PHP
- Homepage:
- Size: 588 KB
- Stars: 139
- Watchers: 16
- Forks: 17
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-php - Disco - A PSR-11 compatible, annotation-based dependency injection container. (Table of Contents / Dependency Injection)
- awesome-projects - Disco - A PSR-11 compatible, annotation-based dependency injection container. (PHP / Dependency Injection)
- awesome-php - Disco - A PSR-11 compatible, annotation-based dependency injection container. (Table of Contents / Dependency Injection)
- awesome-php-cn - Disco - PSR-11兼容,基于注解的依赖注入容器. (目录 / 依赖注入 Dependency Injection)
README
# bitexpert/disco
This package provides a [PSR-11](http://www.php-fig.org/psr/psr-11/) compatible, annotation-based dependency injection container. Have a look at the [disco-demos](https://github.com/bitExpert/disco-demos) project to find out how to use Disco.
[![Build Status](https://github.com/bitExpert/disco/workflows/ci/badge.svg?branch=master)](https://github.com/bitExpert/disco/actions)
[![Coverage Status](https://coveralls.io/repos/github/bitExpert/disco/badge.svg?branch=master)](https://coveralls.io/github/bitExpert/disco?branch=master)
[![Mastodon Follow](https://img.shields.io/mastodon/follow/109408681246972700?domain=https://rheinneckar.social)](https://rheinneckar.social/@bitexpert)## Installation
The preferred way of installing `bitexpert/disco` is through Composer.
You can add `bitexpert/disco` as a dependency, as follows:```
composer.phar require bitexpert/disco
```## 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.```php
get('mySampleService');
```## Documentation
Documentation is [in the docs tree](docs/), and can be compiled using [bookdown](http://bookdown.io).
```console
$ php ./vendor/bin/bookdown docs/bookdown.json
$ php -S 0.0.0.0:8080 -t docs/html/
```Then point your browser to [http://localhost:8080/](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](CONTRIBUTING.md) 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](https://www.sitepoint.com/disco-with-frameworks-and-design-patterns-a-fresh-look-at-dependency-injection/)
- php[architect]: [Education Station: Your Dependency Injection Needs a Disco](https://www.phparch.com/magazine/2016-2/september/)
- Presentation: [Disco - A Fresh Look at DI](https://talks.bitexpert.de/phpugffm16-disco/) at [PHPUGFFM V/2016](http://www.phpugffm.de)## License
Disco is released under the Apache 2.0 license.