Download the PHP package clippy/container without Composer
On this page you can find all versions of the php package clippy/container. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download clippy/container
More information about clippy/container
Files in clippy/container
Package container
Short Description Dependency-injection container inspired by Pimple and PHP-DI Invoker
License MIT
Informations about the package container
clippy/container
This is a derivative of pimple with a few notable changes.
Function parameter injection
In standard Pimple, the service factories all receive Container $c
as input, e.g.
In Clippy's container:
This allows the consumers of services to (progressively) use type-hinting.
Service methods
A "service method" is a function which supports both service-injection and runtime data-passing. For example:
The first parameter to getPassword
is given at runtime ($getPassword('example.com')
); the second parameter ($io
)
is injected automatically.
The service-method is denoted by including ()
in the declaration. Compare:
Autowired objects / anonymous service classes
The following allows for using injection with improvised service classes.
Properties (eg $basicService
) will be pre-populated with the corresponding services.
In the default strict
mode, unmatched properties will produce exceptions. This can be disabled, e.g.
Similarly, you may define a regular service function and use autowiring as part of the logic, e.g.
Sigils
In standard Pimple, you may define alternative handling for a callback by using a wrapper method. Clippy supports wrappers as well as a sigil notation.
All versions of container with dependencies
psr/container Version ~1.1||~2.0
php-di/invoker Version ~2.0
pimple/pimple Version ~3.0