Skip to content

reliese/php-component-dependency

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 

Reliese Component Dependency

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);

About

Dependency Container Abstraction for PHP

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages