aztech / phinject
PHP Dependency Injection Container
Requires
- container-interop/container-interop: ~1.1
- psr/log: ~1.0
- symfony/console: ~2.6
- symfony/yaml: ~2.5
Requires (Dev)
- behat/behat: ~3.0
- guzzle/guzzle: ~3.8
- ocramius/proxy-manager: 0.5.*
- phpmd/phpmd: ~2.2
- phpunit/phpunit: ~4.1
- squizlabs/php_codesniffer: ~2
- vektah/bugfree-dangerzone: ~0.3
- zendframework/zend-json: ~2.2
- zendframework/zend-soap: ~2.2
- zendframework/zend-xmlrpc: ~2.2
Suggests
- guzzle/guzzle: To support RESTful remote object activation
- ocramius/proxy-manager: To support injection of runtime generated proxies
- zendframework/zend-json: To support JSON-RPC remote object activation
- zendframework/zend-soap: To support SOAP remote object activation
- zendframework/zend-xmlrpc: To support XML-RPC remote object activation
README
Phinject is a simple dependency injection container, with extensible activation & injection strategies.
Setup
Composer is the only supported way of installing Phinject. From the root of your project, run the following command:
composer require aztech/phinject
Features
- Compatible with the container-interop specification
- Compatible with delegate containers.
- YAML, JSON or PHP based configuration.
- Lazy-loading dependencies.
- Remote proxies (undocumented).
- Aliases (undocumented).
- Extensible configuration syntax (undocumented).
Usage
The documentation is available here.
We have a getting started guide, followed by more comprehensive documentation (although not yet exhaustive, but that will come):
- Injection types
- References
- Activators
- Lifecycle of objects
- Remote objects (TODO: Write documentation)
- Container interoperability (TODO: Write documentation).
- Extending the configuration syntax
Note All the documentation examples are written using a YAML based configuration, however, you can also use JSON or PHP configuration files. (TODO: Document usage of PHP & JSON config file)
Credits
This library is originally a fork on oliviermadre/dic-it
, available here.
Most of the core features have however been refactored or rewritten, enough that I felt it was time to re-brand this package, in order to both prevent confusion with the original package, and because I did not like the name.