Methods |
public
static
|
addContextualBinding(
class-string[]|class-string $context,
class-string|non-empty-string $id,
(Closure(ContainerInterface): object)|class-string|object|null $class = null,
): ContainerInterface
Add a contextual binding to the container (see {@see ContainerInterface::addContextualBinding()})
Add a contextual binding to the container (see {@see ContainerInterface::addContextualBinding()})
|
#
|
public
static
|
apply(callable(ContainerInterface): ContainerInterface $callback): ContainerInterface
Move to the next method in the chain after applying a callback to the object
Move to the next method in the chain after applying a callback to the object
|
#
|
public
static
|
applyForEach(
iterable<mixed, mixed> $items,
callable(ContainerInterface, mixed, mixed): ContainerInterface $callback,
): ContainerInterface
Move to the next method in the chain after applying a callback to the object for each item in an array or iterator
Move to the next method in the chain after applying a callback to the object for each item in an array or iterator
|
#
|
public
static
|
applyIf(
(callable(ContainerInterface): bool)|bool $condition,
(callable(ContainerInterface): ContainerInterface)|null $then = null,
(callable(ContainerInterface): ContainerInterface)|null $else = null,
): ContainerInterface
Move to the next method in the chain after applying a conditional callback to the object (see {@see Chainable::applyIf(…
Move to the next method in the chain after applying a conditional callback to the object (see {@see Chainable::applyIf()})
|
#
|
public
static
|
bind(class-string $id, (Closure(ContainerInterface): object)|class-string|null $class = null): ContainerInterface
Bind a service to the container (see {@see ContainerInterface::bind()})
Bind a service to the container (see {@see ContainerInterface::bind()})
|
#
|
public
static
|
bindIf(class-string $id, (Closure(ContainerInterface): object)|class-string|null $class = null): ContainerInterface
Bind a service to the container if it isn't already bound
Bind a service to the container if it isn't already bound
|
#
|
public
static
|
get(class-string $id, mixed[] $args = []): object
Resolve a service from the container (see {@see ContainerInterface::get()})
Resolve a service from the container (see {@see ContainerInterface::get()})
|
#
|
public
static
|
getAs(class-string $id, class-string $service, mixed[] $args = []): object
Resolve a partially-resolved service from the container (see {@see ContainerInterface::getAs()})
Resolve a partially-resolved service from the container (see {@see ContainerInterface::getAs()})
|
#
|
public
static
|
getClass(class-string $id): class-string
Resolve a service from the container without returning an instance (see {@see ContainerInterface::getClass()})
Resolve a service from the container without returning an instance (see {@see ContainerInterface::getClass()})
|
#
|
public
static
|
getGlobalContainer(): ContainerInterface
Get the global container, creating it if necessary
Get the global container, creating it if necessary
|
#
|
public
static
|
getProviders(): array<class-string>
Get a list of service providers registered with the container
Get a list of service providers registered with the container
|
#
|
public
static
|
has(class-string $id): bool
Check if a service is bound to the container (see {@see ContainerInterface::has()})
Check if a service is bound to the container (see {@see ContainerInterface::has()})
|
#
|
public
static
|
hasGlobalContainer(): bool
Check if the global container is set
Check if the global container is set
|
#
|
public
static
|
hasInstance(class-string $id): bool
Check if a service resolves to a shared instance
Check if a service resolves to a shared instance
|
#
|
public
static
|
hasProvider(class-string $provider): bool
Check if a service provider is registered with the container
Check if a service provider is registered with the container
|
#
|
public
static
|
hasSingleton(class-string $id): bool
Check if a shared service or instance is bound to the container
Check if a shared service or instance is bound to the container
|
#
|
public
static
|
inContextOf(class-string $id): ContainerInterface
Apply contextual bindings to a copy of the container
Apply contextual bindings to a copy of the container
|
#
|
public
static
|
instance(class-string $id, object $instance): ContainerInterface
Bind a shared instance to the container
Bind a shared instance to the container
|
#
|
public
static
|
provider(
class-string $provider,
class-string[]|null $services = null,
class-string[] $excludeServices = [],
ContainerInterface::* $providerLifetime = ContainerInterface::LIFETIME_INHERIT,
): ContainerInterface
Register a service provider with the container, optionally specifying which of its services to bind or ignore (see {…
Register a service provider with the container, optionally specifying which of its services to bind or ignore (see {@see ContainerInterface::provider()})
|
#
|
public
static
|
providers(
array<class-string|int, class-string> $providers,
ContainerInterface::* $providerLifetime = ContainerInterface::LIFETIME_INHERIT,
): ContainerInterface
Register an array that maps services (usually interfaces) to service providers (classes that extend or implement the…
Register an array that maps services (usually interfaces) to service providers (classes that extend or implement the mapped service) (see {@see ContainerInterface::providers()})
|
#
|
public
static
|
removeInstance(class-string $id): ContainerInterface
Remove a shared instance from the container
Remove a shared instance from the container
|
#
|
public
static
|
setGlobalContainer(ContainerInterface|null $container): void
Set or unset the global container (see {@see ContainerInterface::setGlobalContainer()})
Set or unset the global container (see {@see ContainerInterface::setGlobalContainer()})
|
#
|
public
static
|
singleton(class-string $id, (Closure(ContainerInterface): object)|class-string|null $class = null): ContainerInterface
Bind a shared service to the container (see {@see ContainerInterface::singleton()})
Bind a shared service to the container (see {@see ContainerInterface::singleton()})
|
#
|
public
static
|
singletonIf(class-string $id, (Closure(ContainerInterface): object)|class-string|null $class = null): ContainerInterface
Bind a shared service to the container if it isn't already bound
Bind a shared service to the container if it isn't already bound
|
#
|