class Container implements ArrayAccess, Container (View source)
array | $contextual | The contextual binding map. |
ContextualBindingBuilder | when(string $concrete) Define a contextual binding. | |
bool | bound(string $abstract) Determine if the given abstract type has been bound. | |
bool | resolved(string $abstract) Determine if the given abstract type has been resolved. | |
bool | isShared(string $abstract) Determine if a given type is shared. | |
bool | isAlias(string $name) Determine if a given string is an alias. | |
void | bind(string|array $abstract, Closure|string|null $concrete = null, bool $shared = false) Register a binding with the container. | |
bool | hasMethodBinding(string $method) Determine if the container has a method binding. | |
void | bindMethod(string $method, Closure $callback) Bind a callback to resolve with Container::call. | |
mixed | callMethodBinding(string $method, mixed $instance) Get the method binding for the given method. | |
void | addContextualBinding(string $concrete, string $abstract, Closure|string $implementation) Add a contextual binding to 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. | |
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 | alias(string $abstract, string $alias) Alias a type to a different name. | |
mixed | rebinding(string $abstract, Closure $callback) Bind a new callback to an abstract's rebind event. | |
mixed | refresh(string $abstract, mixed $target, string $method) Refresh an instance on the given target and method. | |
Closure | wrap(Closure $callback, array $parameters = array()) Wrap the given closure such that its dependencies will be injected when executed. | |
mixed | call(callable|string $callback, array $parameters = array(), string|null $defaultMethod = null) Call the given Closure / class@method and inject its dependencies. | |
Closure | factory(string $abstract) Get a closure to resolve the given type from the container. | |
mixed | make(string $abstract) Resolve the given type from the container. | |
mixed | build(string $concrete) Instantiate a concrete instance of the given type. | |
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 for all types. | |
array | getBindings() Get the container's bindings. | |
string | getAlias(string $abstract) Get the alias for an abstract if available. | |
void | forgetInstance(string $abstract) Remove a resolved instance from the instance cache. | |
void | forgetInstances() Clear all of the instances from the container. | |
void | flush() Flush the container of all bindings and resolved instances. | |
static Container | getInstance() Set the globally available instance of the container. | |
static Container | setInstance(Container $container = null) Set the shared instance of the container. | |
bool | offsetExists(string $key) Determine if a given offset exists. | |
mixed | offsetGet(string $key) Get the value at a given offset. | |
void | offsetSet(string $key, mixed $value) Set the value at a given offset. | |
void | offsetUnset(string $key) Unset the value at a given offset. | |
mixed | __get(string $key) Dynamically access container services. | |
void | __set(string $key, mixed $value) Dynamically set container services. |
Define a contextual binding.
Determine if the given abstract type has been bound.
Determine if the given abstract type has been resolved.
Determine if a given type is shared.
Determine if a given string is an alias.
Register a binding with the container.
Determine if the container has a method binding.
Bind a callback to resolve with Container::call.
Get the method binding for the given method.
Add a contextual binding to the container.
Register a binding if it hasn't already been registered.
Register a shared binding in the container.
"Extend" an abstract type in the container.
Register an existing instance as shared in the container.
Assign a set of tags to a given binding.
Resolve all of the bindings for a given tag.
Alias a type to a different name.
Bind a new callback to an abstract's rebind event.
Refresh an instance on the given target and method.
Wrap the given closure such that its dependencies will be injected when executed.
Call the given Closure / class@method and inject its dependencies.
Get a closure to resolve the given type from the container.
Resolve the given type from the container.
Instantiate a concrete instance of the given type.
Register a new resolving callback.
Register a new after resolving callback for all types.
Get the container's bindings.
Get the alias for an abstract if available.
Remove a resolved instance from the instance cache.
Clear all of the instances from the container.
Flush the container of all bindings and resolved instances.
Set the globally available instance of the container.
Determine if a given offset exists.
Get the value at a given offset.
Set the value at a given offset.
Unset the value at a given offset.
Dynamically access container services.
Dynamically set container services.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.4/Illuminate/Container/Container.html