gromnan / pimple-interop
Pimple bridge for PSR-11 ContainerInterface
Installs: 6 987
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- pimple/pimple: ~3.0
- psr/container: ~1.0
Provides
- psr/container-implementation: 1.0.0
This package is auto-updated.
Last update: 2022-02-01 13:01:55 UTC
README
This package is deprecated since support of PSR-11 added to Pimple
PSR-11 is a standardised interface to access services defined in dependency injection containers.
Pimple is
the kind of library that should implement this interface. But it can't because Silex, the micro-framework
on top of Pimple, declares a method Silex\Application::get
that conflicts with Psr\Container\ContainerInterface::get
Usage
Using Pimple, register the PimpleContaineProvider
and create a new service that exposes
Pimple' services through the Psr\Container\ContainerInterface
:
$pimple = new Container\Pimple()
$pimple->register(new GromNaN\Pimple\PimpleContainerProvider());
// Access the services
$pimple['container']->has('my.service');
$pimple['container']->get('my.service');
The service $pimple['container']
can be injected into any service that require a Standard Container implementation.