Container
interface Container (View source)
Methods
bool | bound(string $abstract) Determine if the given abstract type has been bound. | |
void | alias(string $abstract, string $alias) Alias a type to a different name. | |
void | tag(array|string $abstracts, array|mixed $tags) Assign a set of tags to a given binding. | |
array | tagged(array $tag) Resolve all of the bindings for a given tag. | |
void | bind(string|array $abstract, Closure|string|null $concrete = null, bool $shared = false) Register a binding with the container. | |
void | bindIf(string $abstract, Closure|string|null $concrete = null, bool $shared = false) Register a binding if it hasn't already been registered. | |
void | singleton(string|array $abstract, Closure|string|null $concrete = null) Register a shared binding in the container. | |
void | extend(string $abstract, Closure $closure) "Extend" an abstract type in the container. | |
void | instance(string $abstract, mixed $instance) Register an existing instance as shared in the container. | |
ContextualBindingBuilder | when(string $concrete) Define a contextual binding. | |
mixed | make(string $abstract, array $parameters = []) Resolve the given type from the container. | |
mixed | call(callable|string $callback, array $parameters = [], string|null $defaultMethod = null) Call the given Closure / class@method and inject its dependencies. | |
bool | resolved(string $abstract) Determine if the given abstract type has been resolved. | |
void | resolving(string $abstract, Closure $callback = null) Register a new resolving callback. | |
void | afterResolving(string $abstract, Closure $callback = null) Register a new after resolving callback. |
Details
bool bound(string $abstract)
Determine if the given abstract type has been bound.
void alias(string $abstract, string $alias)
Alias a type to a different name.
void tag(array|string $abstracts, array|mixed $tags)
Assign a set of tags to a given binding.
array tagged(array $tag)
Resolve all of the bindings for a given tag.
void bind(string|array $abstract, Closure|string|null $concrete = null, bool $shared = false)
Register a binding with the container.
void bindIf(string $abstract, Closure|string|null $concrete = null, bool $shared = false)
Register a binding if it hasn't already been registered.
void singleton(string|array $abstract, Closure|string|null $concrete = null)
Register a shared binding in the container.
void extend(string $abstract, Closure $closure)
"Extend" an abstract type in the container.
void instance(string $abstract, mixed $instance)
Register an existing instance as shared in the container.
ContextualBindingBuilder when(string $concrete)
Define a contextual binding.
mixed make(string $abstract, array $parameters = [])
Resolve the given type from the container.
mixed call(callable|string $callback, array $parameters = [], string|null $defaultMethod = null)
Call the given Closure / class@method and inject its dependencies.
bool resolved(string $abstract)
Determine if the given abstract type has been resolved.
void resolving(string $abstract, Closure $callback = null)
Register a new resolving callback.
void afterResolving(string $abstract, Closure $callback = null)
Register a new after resolving callback.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.1/Illuminate/Contracts/Container/Container.html