Methods |
public
static
|
addContextualBinding(
class-string[]|class-string $context,
class-string|string $dependency,
(callable(ContainerInterface): mixed)|class-string|mixed $value,
): ContainerInterface
Register a contextual binding with the container (see {@see ContainerInterface::addContextualBinding()})
Register a contextual binding with the container (see {@see ContainerInterface::addContextualBinding()})
|
#
|
public
static
|
apply(callable(static): static $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
|
bind(class-string $id, class-string|null $class = null, mixed[] $args = []): 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, class-string|null $class = null, mixed[] $args = []): 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
|
getGlobalContainer(): ContainerInterface
Get the global container, creating it if necessary
Get the global container, creating it if necessary
|
#
|
public
static
|
getName(class-string $id): class-string
Resolve a service to a concrete class name
Resolve a service to a concrete class name
|
#
|
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 $id): 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 is bound to the container
Check if a shared service is bound to the container
|
#
|
public
static
|
if(
(callable(static): bool)|bool $condition,
(callable(static): static)|null $then = null,
(callable(static): static)|null $else = null,
): ContainerInterface
Move to the next method in the chain after applying a conditional callback to the object (see {@see Chainable::if()})
Move to the next method in the chain after applying a conditional callback to the object (see {@see Chainable::if()})
|
#
|
public
static
|
inContextOf(class-string $id): ContainerInterface
Apply the contextual bindings of a service to a copy of the container
Apply the contextual bindings of a service 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 $id,
class-string[]|null $services = null,
class-string[] $exceptServices = [],
ServiceLifetime::* $lifetime = ServiceLifetime::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, class-string> $serviceMap,
ServiceLifetime::* $lifetime = ServiceLifetime::INHERIT,
): ContainerInterface
Register a service map with the container (see {@see ContainerInterface::providers()})
Register a service map with the container (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
Set or unset the global container
|
#
|
public
static
|
singleton(class-string $id, class-string|null $class = null, mixed[] $args = []): 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, class-string|null $class = null, mixed[] $args = []): 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
|
#
|
public
static
|
unbind(class-string $id): ContainerInterface
Remove a binding from the container
Remove a binding from the container
|
#
|
public
static
|
withEach(iterable<mixed, mixed> $list, callable(static, mixed, mixed): static $callback): ContainerInterface
Move to the next method in the chain after applying a callback to the object with each item in a list
Move to the next method in the chain after applying a callback to the object with each item in a list
|
#
|