Container
class Container implements ArrayAccess, Container (View source)
Properties
array | $contextual | The contextual binding map. |
Methods
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 string is an alias.
Add a contextual binding to 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.
Refresh an instance on the given target and method.
Call the given Closure / class@method and inject its dependencies.
Resolve the given type from the container.
Instantiate a concrete instance of the given type.
Register a new after resolving callback for all types.
Determine if a given type is shared.
Get the container's bindings.
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.
Details
at line line 147
bool
resolved(
string $abstract)
Determine if the given abstract type has been resolved.
at line line 177
void
bind(
string|array $abstract,
Closure|string|null $concrete = null,
bool $shared = false)
Register a binding with the container.
at line line 242
void
addContextualBinding(
string $concrete,
string $abstract,
Closure|string $implementation)
Add a contextual binding to the container.
at line line 255
void
bindIf(
string $abstract,
Closure|string|null $concrete = null,
bool $shared = false)
Register a binding if it hasn't already been registered.
at line line 269
void
singleton(
string|array $abstract,
Closure|string|null $concrete = null)
Register a shared binding in the container.
at line line 305
void
extend(
string $abstract,
Closure $closure)
"Extend" an abstract type in the container.
at line line 325
void
instance(
string $abstract,
mixed $instance)
Register an existing instance as shared in the container.
at line line 359
void
tag(
array|string $abstracts,
array|mixed $tags)
Assign a set of tags to a given binding.
at line line 423
mixed
rebinding(
string $abstract,
Closure $callback)
Bind a new callback to an abstract's rebind event.
at line line 440
mixed
refresh(
string $abstract,
mixed $target,
string $method)
Refresh an instance on the given target and method.
at line line 484
Closure
wrap(
Closure $callback,
array $parameters = array())
Wrap the given closure such that its dependencies will be injected when executed.
at line line 499
mixed
call(
callable|string $callback,
array $parameters = array(),
string|null $defaultMethod = null)
Call the given Closure / class@method and inject its dependencies.
at line line 616
mixed
make(
string $abstract,
array $parameters = array())
Resolve the given type from the container.
at line line 729
mixed
build(
string $concrete,
array $parameters = array())
Instantiate a concrete instance of the given type.
at line line 895
void
resolving(
string $abstract,
Closure $callback = null)
Register a new resolving callback.
at line line 911
void
afterResolving(
string $abstract,
Closure $callback = null)
Register a new after resolving callback for all types.
at line line 1110
void
forgetInstance(
string $abstract)
Remove a resolved instance from the instance cache.
at line line 1143
static
Container
getInstance()
Set the globally available instance of the container.