Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
Merge pull request #182 from jsoumelidis/sf-container-support
Browse files Browse the repository at this point in the history
Symfony DI container support
  • Loading branch information
geerteltink committed Dec 12, 2017
2 parents 3d62d3c + e2498d3 commit 1bce076
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"require-dev": {
"composer/composer": "^1.5.2",
"filp/whoops": "^2.1.12",
"jsoumelidis/zend-sf-di-config": "^0.1",
"mikey179/vfsstream": "^1.6.5",
"northwoods/container": "^1.2",
"phpunit/phpunit": "^5.7.23 || ^6.4.3",
Expand Down
1 change: 1 addition & 0 deletions src/ExpressiveInstaller/OptionalPackages.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class OptionalPackages
private $devDependencies = [
'composer/composer',
'filp/whoops',
'jsoumelidis/zend-sf-di-config',
'mikey179/vfsstream',
'northwoods/container',
'zendframework/zend-auradi-config',
Expand Down
9 changes: 9 additions & 0 deletions src/ExpressiveInstaller/Resources/config/container-sf-di.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

use JSoumelidis\SymfonyDI\Config\Config;
use JSoumelidis\SymfonyDI\Config\ContainerFactory;

$config = require realpath(__DIR__) . '/config.php';
$factory = new ContainerFactory();

return $factory(new Config($config));
14 changes: 14 additions & 0 deletions src/ExpressiveInstaller/Resources/config/sf-container.global.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
return [
'sf-container.enable_cache' => true,
'sf-container.cache_file' => __DIR__ . '/../../data/sf-container-cache.php',
//Other useful options
/*
'sf-container.cache_class' =>
'CustomClassName', The class name of the cached container
'sf-container.cache_class_ns' =>
'CustomClassNamespace', The namespace of the cached container
'sf-container.cache_base_class' =>
'Container', The base class that the cached container will extend
*/
];
16 changes: 16 additions & 0 deletions src/ExpressiveInstaller/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
return [
'packages' => [
'filp/whoops' => '^2.1.12',
'jsoumelidis/zend-sf-di-config' => '^0.1',
'northwoods/container' => '^1.2',
'zendframework/zend-auradi-config' => '^0.2',
'zendframework/zend-expressive-aurarouter' => '^2.0',
Expand Down Expand Up @@ -105,6 +106,21 @@
'Resources/config/container-auryn.php' => 'config/container.php',
],
],
5 => [
'name' => 'Symfony DI Container',
'packages' => [
'jsoumelidis/zend-sf-di-config',
],
'flat' => [
'Resources/config/container-sf-di.php' => 'config/container.php',
],
'modular' => [
'Resources/config/container-sf-di.php' => 'config/container.php',
],
'minimal' => [
'Resources/config/container-sf-di.php' => 'config/container.php',
],
],
],
],

Expand Down
4 changes: 4 additions & 0 deletions test/ExpressiveInstallerTest/ContainersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Northwoods\Container\InjectorContainer as AurynContainer;
use Pimple\Psr11\Container as PimpleContainer;
use Psr\Container\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder as SfContainerBuilder;
use Zend\Expressive;
use Zend\ServiceManager\ServiceManager as ZendServiceManagerContainer;

Expand Down Expand Up @@ -108,6 +109,9 @@ public function containerProvider()
'auryn-minimal' => [OptionalPackages::INSTALL_MINIMAL, 4, 2, 'minimal-files', 404, AurynContainer::class],
'auryn-flat' => [OptionalPackages::INSTALL_FLAT, 4, 2, 'copy-files', 200, AurynContainer::class],
'auryn-modular' => [OptionalPackages::INSTALL_MODULAR, 4, 2, 'copy-files', 200, AurynContainer::class],
'sf-di-minimal' => [OptionalPackages::INSTALL_MINIMAL, 4, 2, 'minimal-files', 404, SfContainerBuilder::class],
'sf-di-flat' => [OptionalPackages::INSTALL_FLAT, 4, 2, 'copy-files', 200, SfContainerBuilder::class],
'sf-di-modular' => [OptionalPackages::INSTALL_MODULAR, 4, 2, 'copy-files', 200, SfContainerBuilder::class],
];
// @codingStandardsIgnoreEnd
}
Expand Down

0 comments on commit 1bce076

Please sign in to comment.