$values
$values :
Container main class.
offsetSet(string $id, mixed $value)
Sets a parameter or an object.
Objects must be defined as Closures.
Allowing any PHP callable leads to difficult to debug problems as function names (strings) are callable (creating a function with the same name as an existing parameter would break your container).
string | $id | The unique identifier for the parameter or object |
mixed | $value | The value of the parameter or a closure to define an object |
Prevent override of a frozen service
factory(callable $callable) : callable
Marks a callable as being a factory service.
callable | $callable | A service definition to be used as a factory |
Service definition has to be a closure or an invokable object
The passed callable
protect(callable $callable) : callable
Protects a callable from being interpreted as a service.
This is useful when you want to store a callable as a parameter.
callable | $callable | A callable to protect from being evaluated |
Service definition has to be a closure or an invokable object
The passed callable
raw(string $id) : mixed
Gets a parameter or the closure defining an object.
string | $id | The unique identifier for the parameter or object |
If the identifier is not defined
The value of the parameter or the closure defining an object
extend(string $id, callable $callable) : callable
Extends an object definition.
Useful when you want to extend an existing object definition, without necessarily loading that object.
string | $id | The unique identifier for the object |
callable | $callable | A service definition to extend the original |
If the identifier is not defined
If the service is frozen
If the identifier belongs to a parameter
If the extension callable is not a closure or an invokable object
The wrapped callable
register(\Pimple\ServiceProviderInterface $provider, array $values = array()) : static
Registers a service provider.
\Pimple\ServiceProviderInterface | $provider | A ServiceProviderInterface instance |
array | $values | An array of values that customizes the provider |