From 3041bd0b9d28536be2a5749ca7417ac0788d6531 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 30 May 2018 05:04:06 +0700 Subject: [PATCH 1/2] adding PimpleService --- composer.json | 1 + src/Transformer/PimpleService.php | 0 2 files changed, 1 insertion(+) create mode 100644 src/Transformer/PimpleService.php diff --git a/composer.json b/composer.json index 0a873da7..9d983fec 100644 --- a/composer.json +++ b/composer.json @@ -33,6 +33,7 @@ "php-coveralls/php-coveralls": "^2.0", "phpstan/phpstan": "0.10.xdev", "phpstan/phpstan-beberlei-assert": "0.10.xdev", + "pimple/pimple": "^3.2", "symfony/dependency-injection": "^4.0", "zendframework/zend-expressive": "^3.0", "zendframework/zend-expressive-zendviewrenderer": "^2.0", diff --git a/src/Transformer/PimpleService.php b/src/Transformer/PimpleService.php new file mode 100644 index 00000000..e69de29b From 1ab89f1132d2c7e331306ac653f4aa707d3fd164 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 30 May 2018 05:11:27 +0700 Subject: [PATCH 2/2] apply service with Pimple --- composer.json | 2 +- spec/Middleware/ExpressiveFactorySpec.php | 3 +++ src/Middleware/ExpressiveFactory.php | 3 +++ src/Transformer/PimpleService.php | 28 +++++++++++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9d983fec..d039942e 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "samsonasik/error-hero-module", "type": "library", "description": "A Hero for your Zend Framework application to trap php errors & exceptions", - "keywords": ["zf2", "zf3", "error", "expressive", "hero", "log", "logger", "logging", "mail", "db", "doctrine", "handler", "psr3", "psr7", "psr11", "psr15", "zend-view", "twig", "plates", "symfony", "aura", "auryn"], + "keywords": ["zf2", "zf3", "error", "expressive", "hero", "log", "logger", "logging", "mail", "db", "doctrine", "handler", "psr3", "psr7", "psr11", "psr15", "zend-view", "twig", "plates", "symfony", "aura", "auryn", "pimple"], "homepage": "https://github.com/samsonasik/ErrorHeroModule", "license": "MIT", "authors": [ diff --git a/spec/Middleware/ExpressiveFactorySpec.php b/spec/Middleware/ExpressiveFactorySpec.php index 614e3db6..900c92cf 100644 --- a/spec/Middleware/ExpressiveFactorySpec.php +++ b/spec/Middleware/ExpressiveFactorySpec.php @@ -14,6 +14,8 @@ use ErrorHeroModule\Spec\Fixture\NotSupportedContainer; use Kahlan\Plugin\Double; use Northwoods\Container\InjectorContainer as AurynInjectorContainer; +use Pimple\Container as PimpleContainer; +use Pimple\Psr11\Container as Psr11PimpleContainer; use RuntimeException; use Symfony\Component\DependencyInjection\ContainerBuilder as SymfonyContainerBuilder; use Zend\Db\Adapter\Adapter; @@ -31,6 +33,7 @@ AuraContainer::class => (new AuraContainerBuilder())->newInstance(), SymfonyContainerBuilder::class => new SymfonyContainerBuilder(), AurynInjectorContainer::class => new AurynInjectorContainer(new AurynInjector()), + Psr11PimpleContainer::class => new Psr11PimpleContainer(new PimpleContainer()), ]; }); diff --git a/src/Middleware/ExpressiveFactory.php b/src/Middleware/ExpressiveFactory.php index b4def0e1..bd931be6 100644 --- a/src/Middleware/ExpressiveFactory.php +++ b/src/Middleware/ExpressiveFactory.php @@ -10,8 +10,10 @@ use ErrorHeroModule\Transformer\AuraService; use ErrorHeroModule\Transformer\AurynService; use ErrorHeroModule\Transformer\Doctrine; +use ErrorHeroModule\Transformer\PimpleService; use ErrorHeroModule\Transformer\SymfonyService; use Northwoods\Container\InjectorContainer as AurynInjectorContainer; +use Pimple\Psr11\Container as Psr11PimpleContainer; use Psr\Container\ContainerInterface; use RuntimeException; use Symfony\Component\DependencyInjection\ContainerBuilder as SymfonyContainerBuilder; @@ -24,6 +26,7 @@ class ExpressiveFactory SymfonyContainerBuilder::class => SymfonyService::class, AuraContainer::class => AuraService::class, AurynInjectorContainer::class => AurynService::class, + Psr11PimpleContainer::class => PimpleService::class, ]; private function createMiddlewareInstance(ContainerInterface $container, array $configuration) : Expressive diff --git a/src/Transformer/PimpleService.php b/src/Transformer/PimpleService.php index e69de29b..c95a064b 100644 --- a/src/Transformer/PimpleService.php +++ b/src/Transformer/PimpleService.php @@ -0,0 +1,28 @@ +pimple; + }, null, $container)($container); + $pimple['ErrorHeroModuleLogger'] = $logger; + + return $container; + } +} \ No newline at end of file