Container
Methods
bound ( $abstract ) : bool
Determine if the given abstract type has been bound.
Parameters
- $abstract string
alias ( $abstract , $alias ) : void
Alias a type to a different name.
Parameters
- $abstract string
- $alias string
tag ( $abstracts , $tags ) : void
Assign a set of tags to a given binding.
Parameters
- $abstracts array|string
- $tags array|mixed
tagged ( $tag ) : iterable
Resolve all of the bindings for a given tag.
Parameters
- $tag string
bind ( $abstract , $concrete , $shared ) : void
Register a binding with the container.
Parameters
- $abstract string
- $concrete Closure |string|null
- $shared bool
bindIf ( $abstract , $concrete , $shared ) : void
Register a binding if it hasn't already been registered.
Parameters
- $abstract string
- $concrete Closure |string|null
- $shared bool
singleton ( $abstract , $concrete ) : void
Register a shared binding in the container.
Parameters
- $abstract string
- $concrete Closure |string|null
singletonIf ( $abstract , $concrete ) : void
Register a shared binding if it hasn't already been registered.
Parameters
- $abstract string
- $concrete Closure |string|null
extend ( $abstract , Closure $closure ) : void
"Extend" an abstract type in the container.
Parameters
- $abstract string
- $closure Closure
instance ( $abstract , $instance ) : mixed
Register an existing instance as shared in the container.
Parameters
- $abstract string
- $instance mixed
addContextualBinding ( $concrete , $abstract , $implementation ) : void
Add a contextual binding to the container.
Parameters
- $concrete string
- $abstract string
- $implementation Closure |string
when ( $concrete ) : ContextualBindingBuilder
Define a contextual binding.
Parameters
- $concrete string|array
factory ( $abstract ) : Closure
Get a closure to resolve the given type from the container.
Parameters
- $abstract string
flush ( ) : void
Flush the container of all bindings and resolved instances.
make ( $abstract , array $parameters ) : mixed
Resolve the given type from the container.
Parameters
- $abstract string
- $parameters array
call ( $callback , array $parameters , $defaultMethod ) : mixed
Call the given Closure / class@method and inject its dependencies.
Parameters
- $callback callable|string
- $parameters array
- $defaultMethod string|null
resolved ( $abstract ) : bool
Determine if the given abstract type has been resolved.
Parameters
- $abstract string
resolving ( $abstract , Closure $callback ) : void
Register a new resolving callback.