Container ServiceProvider
Service provider bundle related services together helping to organize your application's dependencies. They also help improve performance of applications with many services by allowing service registration to be deferred until services are needed.
?DefinitionContainerInterface
string
array<string>
List of ids of services this provider provides.
Delegate to the bootstrap() method
Bootstrap hook for ServiceProviders
Get the container.
The provides method is a way to let the container know that a service is provided by this service provider.
Call the abstract services() method.
Register the services in a provider.
boot(): void
Delegate to the bootstrap() method
This method wraps the league/container function so users only need to use the CakePHP bootstrap() interface.
void
bootstrap(Cake\Core\ContainerInterface $container): void
Bootstrap hook for ServiceProviders
This hook should be implemented if your service provider needs to register additional service providers, load configuration files or do any other work when the service provider is added to the container.
Cake\Core\ContainerInterface
$container The container to add services to.
void
getContainer(): Cake\Core\ContainerInterface
Get the container.
This method's actual return type and documented return type differ because PHP 7.2 doesn't support return type narrowing.
Cake\Core\ContainerInterface
getIdentifier(): string
string
provides(string $id): bool
The provides method is a way to let the container know that a service is provided by this service provider.
Every service that is registered via this service provider must have an alias added to this array or it will be ignored.
string
$id Identifier.
bool
register(): void
Call the abstract services() method.
This method primarily exists as a shim between the interface that league/container has and the one we want to offer in CakePHP.
void
services(Cake\Core\ContainerInterface $container): void
Register the services in a provider.
All services registered in this method should also be included in the $provides property so that services can be located.
Cake\Core\ContainerInterface
$container The container to add services to.
void
setContainer(DefinitionContainerInterface $container): ContainerAwareInterface
DefinitionContainerInterface
$container ContainerAwareInterface
setIdentifier(string $id): ServiceProviderInterface
string
$id ServiceProviderInterface
?DefinitionContainerInterface
string
List of ids of services this provider provides.
array<string>
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.4/class-Cake.Core.ServiceProvider.html