Interface Salient\Contract\Container\ContainerInterface

extends ContainerInterface, Chainable, Instantiable, Unloadable

A service container with contextual bindings

If a service resolves to a new instance of a class that implements ContainerAwareInterface, the container is passed to its {@see ContainerAwareInterface::setContainer()} method.

Then, if the resolved instance implements {@see ServiceAwareInterface}, its {@see ServiceAwareInterface::setService()} method is called.

A service provider registered via {@see provider()} or {@see providers()} may also implement any combination of the following interfaces:

  • {@see SingletonInterface} to be instantiated once per container
  • {@see HasServices} to specify which of its interfaces are services to register with the container
  • {@see HasBindings} to bind additional services to the container
  • {@see HasContextualBindings} to bind services to the container that only apply in the context of the provider

{@see SingletonInterface} is ignored if a lifetime other than {@see ServiceLifetime::INHERIT} is given when the service provider is registered.

Methods
Methods inherited from Salient\Contract\Core\Chainable
apply(), if(), withEach()
Methods inherited from Salient\Contract\Core\Unloadable
unload()