Container
interface Container implements ContainerInterface
Methods
No description
Determine if the given abstract type has been bound.
Alias a type to a different name.
Assign a set of tags to a given binding.
Resolve all of the bindings for a given tag.
Bind a callback to resolve with Container::call.
Register a shared binding if it hasn't already been registered.
Register an existing instance as shared in the container.
Remove a resolved instance from the instance cache.
Add a contextual binding to the container.
Define a contextual binding.
Flush the container of all bindings and resolved instances.
Resolve the given type from the container.
Resolve the given type with a transient implicit lifetime.
Call the given Closure / class@method and inject its dependencies.
Determine if the given abstract type has been resolved.
Register a new before resolving callback.
Register a new after resolving callback.
Details
at line 20
mixed
get(string $id)
No description
at line 25
bool
bound(string $abstract)
Determine if the given abstract type has been bound.
at line 32
void
alias(string $abstract, string $alias)
Alias a type to a different name.
at line 37
void
tag(array|string $abstracts, array|string $tags)
Assign a set of tags to a given binding.
at line 42
iterable
tagged(string $tag)
Resolve all of the bindings for a given tag.
at line 47
void
bind(Closure|string $abstract, Closure|string|null $concrete = null, bool $shared = false)
Register a binding with the container.
at line 52
void
bindMethod(array|string $method, Closure $callback)
Bind a callback to resolve with Container::call.
at line 57
void
bindIf(Closure|string $abstract, Closure|string|null $concrete = null, bool $shared = false)
Register a binding if it hasn't already been registered.
at line 62
void
singleton(Closure|string $abstract, Closure|string|null $concrete = null)
Register a shared binding in the container.
at line 67
void
singletonIf(Closure|string $abstract, Closure|string|null $concrete = null)
Register a shared binding if it hasn't already been registered.
at line 72
void
scoped(Closure|string $abstract, Closure|string|null $concrete = null)
Register a scoped binding in the container.
at line 77
void
scopedIf(Closure|string $abstract, Closure|string|null $concrete = null)
Register a scoped binding if it hasn't already been registered.
at line 84
void
extend(string $abstract, Closure $closure)
"Extend" an abstract type in the container.
at line 94
mixed
instance(string $abstract, mixed $instance)
Register an existing instance as shared in the container.
at line 99
void
forgetInstance(string $abstract)
Remove a resolved instance from the instance cache.
at line 104
void
addContextualBinding(string $concrete, string $abstract, mixed $implementation)
Add a contextual binding to the container.
at line 109
ContextualBindingBuilder
when(string|array $concrete)
Define a contextual binding.
at line 119
Closure
factory(string $abstract)
Get a closure to resolve the given type from the container.
at line 124
void
flush()
Flush the container of all bindings and resolved instances.
at line 136
mixed
make(string $abstract, array $parameters = [])
Resolve the given type from the container.
at line 150
mixed
makeTransient(string $abstract)
Resolve the given type with a transient implicit lifetime.
Explicit lifetimes remain authoritative.
at line 160
mixed
build(Closure|string $concrete)
Instantiate a concrete instance of the given type.
Unlike make(), this always creates a fresh instance — it bypasses bindings, aliases, and singleton/auto-singleton caching.
at line 170
mixed
buildWith(Closure|string $concrete, array $parameters = [])
Instantiate a concrete instance with the given parameter overrides.
Unlike make(), this always creates a fresh instance — it bypasses bindings, aliases, and singleton/auto-singleton caching.
at line 175
mixed
call(callable|string $callback, array $parameters = [], string|null $defaultMethod = null)
Call the given Closure / class@method and inject its dependencies.
at line 180
bool
resolved(string $abstract)
Determine if the given abstract type has been resolved.
at line 185
mixed
rebinding(string $abstract, Closure $callback)
Register a new rebinding callback for an abstract type.
at line 190
void
beforeResolving(Closure|string $abstract, Closure|null $callback = null)
Register a new before resolving callback.