@@ -12,14 +12,11 @@ Pimple only supports programmatic creation at this time.
1212
1313## Installing Pimple
1414
15- Pimple does not currently (as of v3) implement
16- [ PSR-11 Container] ( https://github.com/php-fig/container ) ; as
17- such, you need to install the ` xtreamwayz/pimple-container-interop ` project,
18- which provides a [ PSR-11 Container] ( https://github.com/php-fig/container )
19- wrapper around Pimple v3:
15+ Pimple implements [ PSR-11 Container] ( https://github.com/php-fig/container )
16+ as of version 3.2.
2017
2118``` bash
22- $ composer require xtreamwayz /pimple-container-interop
19+ $ composer require pimple /pimple
2320```
2421
2522## Configuring Pimple
@@ -29,13 +26,14 @@ recommend doing this in a dedicated script that returns the Pimple instance; in
2926this example, we'll have that in ` config/container.php ` .
3027
3128``` php
32- use Xtreamwayz\Pimple\Container as Pimple;
29+ use Pimple\Container as PimpleContainer;
30+ use Pimple\Psr11\Container as PsrContainer;
3331use Zend\Expressive\Container;
3432use Zend\Expressive\Plates\PlatesRenderer;
3533use Zend\Expressive\Router;
3634use Zend\Expressive\Template\TemplateRendererInterface;
3735
38- $container = new Pimple ();
36+ $container = new PimpleContainer ();
3937
4038// Application and configuration
4139$container['config'] = include 'config/config.php';
@@ -44,7 +42,7 @@ $container['Zend\Expressive\Application'] = new Container\ApplicationFactory;
4442// Routing
4543// In most cases, you can instantiate the router you want to use without using a
4644// factory:
47- $container['Zend\Expressive\Router\RouterInterface'] = function ($container) {
45+ $container['Zend\Expressive\Router\RouterInterface'] = function (PimpleContainer $container) {
4846 return new Router\Aura();
4947};
5048
@@ -59,7 +57,7 @@ $container[Zend\Expressive\Middleware\NotFoundHandler::class] = new Container\No
5957// Templating
6058// In most cases, you can instantiate the template renderer you want to use
6159// without using a factory:
62- $container[TemplateRendererInterface::class] = function ($container) {
60+ $container[TemplateRendererInterface::class] = function (PimpleContainer $container) {
6361 return new PlatesRenderer();
6462};
6563
@@ -88,7 +86,7 @@ $container['Zend\Expressive\FinalHandler'] = new Container\TemplatedErrorHandler
8886// - Expressive 2.X:
8987$container[Zend\Expressive\Middleware\ErrorResponseGenerator::class] = new Container\ErrorResponseGeneratorFactory();
9088
91- return $container;
89+ return new PsrContainer( $container) ;
9290```
9391
9492Your bootstrap (typically ` public/index.php ` ) will then look like this:
0 commit comments