Fr3nch13/CakePHP Utilities

ServiceProvider extends AbstractServiceProvider
in package
implements BootableServiceProviderInterface

AbstractYes

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.

Table of Contents

Interfaces

BootableServiceProviderInterface

Properties

$container  : DefinitionContainerInterface|null
$identifier  : string
$provides  : array<string|int, string>
List of ids of services this provider provides.

Methods

boot()  : void
Delegate to the bootstrap() method
bootstrap()  : void
Bootstrap hook for ServiceProviders
getContainer()  : ContainerInterface
Get the container.
getIdentifier()  : string
provides()  : bool
The provides method is a way to let the container know that a service is provided by this service provider.
register()  : void
Call the abstract services() method.
services()  : void
Register the services in a provider.
setContainer()  : ContainerAwareInterface
setIdentifier()  : ServiceProviderInterface

Properties

$provides

List of ids of services this provider provides.

protected array<string|int, string> $provides = []
Tags
see
ServiceProvider::provides()

Methods

boot()

Delegate to the bootstrap() method

public boot() : void

This method wraps the league/container function so users only need to use the CakePHP bootstrap() interface.

bootstrap()

Bootstrap hook for ServiceProviders

public bootstrap(ContainerInterface $container) : void

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.

Parameters
$container : ContainerInterface

The container to add services to.

provides()

The provides method is a way to let the container know that a service is provided by this service provider.

public provides(string $id) : bool

Every service that is registered via this service provider must have an alias added to this array or it will be ignored.

Parameters
$id : string

Identifier.

Return values
bool

register()

Call the abstract services() method.

public register() : void

This method primarily exists as a shim between the interface that league/container has and the one we want to offer in CakePHP.

services()

Register the services in a provider.

public abstract services(ContainerInterface $container) : void

All services registered in this method should also be included in the $provides property so that services can be located.

Parameters
$container : ContainerInterface

The container to add services to.


        
On this page

Search results