dependency injection container
Installs: 85
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
Requires
- php: >=7.0.0
- psr/container: *
Requires (Dev)
This package is auto-updated.
Last update: 2024-05-08 00:15:49 UTC
README
Dependency injection container Martin Fowler's article
Dependency injection container — it is an object to instantiate the class and its dependent objects.
This is in accordance with the recommendations of PSR-11.
It supports the following kinds of dependency injection:
- Constructor injection;
- Property injection;
- Setter injection
Example:
use suffi\di\Container; $foo = new Foo(); $bar = new Bar(); $thy = new Thy(); $container->set('foo', $foo); $container->set('bar', $bar); $container->set('thy', $thy); $container->setDefinition('common', 'Common') ->parameter('foo', 'foo') ->property('bar', $bar) ->setter('thy', 'thy'); $common = $container->get('common');
Installation
composer require dmitry-suffi/di
Documentation
the documentation can be found here:
Tests
You can also browse the functional tests
License
Copyright (c) 2016-2016 Dmitry Suffi. Released under the MIT license.