reliese / component-dependency
Dependencies Component
Installs: 18
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 1
pkg:composer/reliese/component-dependency
Requires
- php: >=7.2
README
This is the definition of a Dependency Container, also known as Inversion of Control Container, Service Container.
The Container Interface
It comes with three groups of methods:
Dependency Registration
- Allows for singleton registration
/** * @param string $dependency * @param Closure $abstraction * * @return Container */ public function singleton(string $dependency, Closure $abstraction) : Container;
- Allows for a non singleton registration
/** * @param string $dependency * @param Closure $abstraction * * @return Container */ public function register(string $dependency, Closure $abstraction) : Container;
Service Location
Each registered dependency can be retrieved with the resolve
method.
/** * @param string $dependency * * @return mixed * @throws UnresolvableDependencyException */ public function resolve(string $dependency);
Method Injection
/** * @param object $object * @param string $method * * @return mixed * @throws UnresolvableDependencyException */ public function call(object $object, string $method);