Repository: pheature-flags/pheature-flags (php)

Issue:
[mezzio-toggle] Make as optional the installation of some pheature packages
Epic: #24 Mezzio Toggle
Package: https://github.com/pheature-flags/mezzio-toggle

Description:

Right now, if you want to run Pheature Flags using the Mezzio Toggle, you need to install all packages of the Pheature framework. We should make them optional, adding some checks to the `ToggleConfigProvider` to add services only if they've been previously installed.

Pull request description:
Issue#261 fix tests
Closes #261 

Patch:
diff --git a/packages/dbal-toggle/composer.json b/packages/dbal-toggle/composer.json
index d717179..6c594aa 100644
--- a/packages/dbal-toggle/composer.json
+++ b/packages/dbal-toggle/composer.json
@@ -19,10 +19,10 @@
         "php": "^7.4|^8.0",
         "doctrine/dbal": ">=2.6 || ^3.0.0",
         "pheature/toggle-core": "^0.1.1",
-        "pheature/toggle-model": "^0.1.1",
-        "pheature/toggle-crud": "^0.1.1"
+        "pheature/toggle-model": "^0.1.1"
     },
     "require-dev": {
+        "icanhazstring/composer-unused": "^0.7.5",
         "infection/infection": "^0.23.0",
         "phpro/grumphp": "^1.0",
         "phpstan/phpstan": "^0.12",
@@ -45,6 +45,7 @@
     },
     "scripts": {
         "check-all": [
+            "composer unused",
             "@cs-check",
             "@test",
             "@inspect",
diff --git a/packages/inmemory-toggle/composer.json b/packages/inmemory-toggle/composer.json
index 622cbd4..41f9cba 100644
--- a/packages/inmemory-toggle/composer.json
+++ b/packages/inmemory-toggle/composer.json
@@ -21,6 +21,7 @@
         "pheature/toggle-model": "^0.1.1"
     },
     "require-dev": {
+        "icanhazstring/composer-unused": "^0.7.5",
         "infection/infection": "^0.23.0",
         "phpro/grumphp": "^1.0",
         "phpstan/phpstan": "^0.12",
@@ -42,6 +43,7 @@
     },
     "scripts": {
         "check-all": [
+            "composer unused",
             "@cs-check",
             "@test",
             "@inspect",
diff --git a/packages/laravel-toggle/composer.json b/packages/laravel-toggle/composer.json
index 3d72972..65d53eb 100644
--- a/packages/laravel-toggle/composer.json
+++ b/packages/laravel-toggle/composer.json
@@ -27,10 +27,10 @@
         "pheature/toggle-crud": "^0.1.1",
         "pheature/toggle-crud-psr7-api": "^0.1.1",
         "pheature/toggle-crud-psr11-factories": "^0.1.1",
-        "pheature/toggle-model": "^0.1.1",
-        "symfony/psr-http-message-bridge": "^2.1"
+        "pheature/toggle-model": "^0.1.1"
     },
     "require-dev": {
+        "icanhazstring/composer-unused": "^0.7.5",
         "infection/infection": "^0.23.0",
         "phpro/grumphp": "^1.0",
         "phpstan/phpstan": "^0.12",
@@ -52,6 +52,7 @@
     },
     "scripts": {
         "check-all": [
+            "composer unused",
             "@cs-check",
             "@test",
             "@inspect",
diff --git a/packages/mezzio-toggle/composer.json b/packages/mezzio-toggle/composer.json
index da5c48e..2e86c30 100644
--- a/packages/mezzio-toggle/composer.json
+++ b/packages/mezzio-toggle/composer.json
@@ -25,15 +25,16 @@
         "pheature/toggle-model": "^0.1.1"
     },
     "require-dev": {
+        "icanhazstring/composer-unused": "^0.7.5",
         "infection/infection": "^0.23.0",
+        "pheature/php-sdk": "^0.1.1",
         "phpro/grumphp": "^1.0",
         "phpstan/phpstan": "^0.12",
         "phpunit/phpunit": "^8.0 || ^9.0",
         "roave/infection-static-analysis-plugin": "^1.8",
         "squizlabs/php_codesniffer": "^3.4",
         "symfony/var-dumper": "^4.2 || ^5.0",
-        "vimeo/psalm": "^4.4",
-        "pheature/php-sdk": "^0.1.1"
+        "vimeo/psalm": "^4.4"
     },
     "autoload": {
         "psr-4": {
@@ -47,6 +48,7 @@
     },
     "scripts": {
         "check-all": [
+            "composer unused  --excludePackage=laminas/laminas-diactoros",
             "@cs-check",
             "@test",
             "@inspect",
@@ -67,5 +69,9 @@
     },
     "config": {
         "sort-packages": true
+    },
+    "suggest": {
+        "pheature/dbal-toggle": "Dbal toggle implementation",
+        "pheature/inmemory-toggle": "In memory toggle implementation"
     }
 }
diff --git a/packages/php-sdk/composer.json b/packages/php-sdk/composer.json
index 9c193b5..5f9d2bb 100644
--- a/packages/php-sdk/composer.json
+++ b/packages/php-sdk/composer.json
@@ -21,6 +21,7 @@
         "psr/container": "^1.0.0|^2.0.0"
     },
     "require-dev": {
+        "icanhazstring/composer-unused": "^0.7.5",
         "infection/infection": "^0.23.0",
         "phpro/grumphp": "^1.0",
         "phpstan/phpstan": "^0.12",
@@ -42,6 +43,7 @@
     },
     "scripts": {
         "check-all": [
+            "composer unused",
             "@cs-check",
             "@test",
             "@inspect",
diff --git a/packages/toggle-crud-psr11-factories/src/CommandRunnerFactory.php b/packages/php-sdk/src/CommandRunnerFactory.php
similarity index 93%
rename from packages/toggle-crud-psr11-factories/src/CommandRunnerFactory.php
rename to packages/php-sdk/src/CommandRunnerFactory.php
index b842864..707cdf9 100644
--- a/packages/toggle-crud-psr11-factories/src/CommandRunnerFactory.php
+++ b/packages/php-sdk/src/CommandRunnerFactory.php
@@ -2,7 +2,7 @@
 
 declare(strict_types=1);
 
-namespace Pheature\Crud\Psr11\Toggle;
+namespace Pheature\Sdk;
 
 use Pheature\Core\Toggle\Read\FeatureFinder;
 use Pheature\Core\Toggle\Read\Toggle;
diff --git a/packages/php-sdk/src/Container/ConfigProvider.php b/packages/php-sdk/src/Container/ConfigProvider.php
index f56aa82..4dc3bb9 100644
--- a/packages/php-sdk/src/Container/ConfigProvider.php
+++ b/packages/php-sdk/src/Container/ConfigProvider.php
@@ -4,8 +4,8 @@ declare(strict_types=1);
 
 namespace Pheature\Sdk\Container;
 
-use Pheature\Crud\Psr11\Toggle\CommandRunnerFactory;
 use Pheature\Sdk\CommandRunner;
+use Pheature\Sdk\CommandRunnerFactory;
 
 final class ConfigProvider
 {
diff --git a/packages/symfony-toggle/composer.json b/packages/symfony-toggle/composer.json
index ef45793..54b8d24 100644
--- a/packages/symfony-toggle/composer.json
+++ b/packages/symfony-toggle/composer.json
@@ -24,6 +24,7 @@
     },
     "require-dev": {
         "doctrine/dbal": ">=2.6 || ^3.0.0",
+        "icanhazstring/composer-unused": "^0.7.5",
         "infection/infection": "^0.23.0",
         "pheature/dbal-toggle": "^0.1.1",
         "pheature/inmemory-toggle": "^0.1.1",
@@ -49,6 +50,7 @@
     },
     "scripts": {
         "check-all": [
+            "composer unused --excludePackage=symfony/framework-bundle ",
             "@cs-check",
             "@test",
             "@inspect",
diff --git a/packages/toggle-core/composer.json b/packages/toggle-core/composer.json
index 1354f85..fd8066a 100644
--- a/packages/toggle-core/composer.json
+++ b/packages/toggle-core/composer.json
@@ -19,6 +19,7 @@
         "php": "^7.4|^8.0"
     },
     "require-dev": {
+        "icanhazstring/composer-unused": "^0.7.5",
         "infection/infection": "^0.23.0",
         "phpro/grumphp": "^1.0",
         "phpstan/phpstan": "^0.12",
@@ -40,6 +41,7 @@
     },
     "scripts": {
         "check-all": [
+            "composer unused",
             "@cs-check",
             "@test",
             "@inspect",
diff --git a/packages/toggle-core/src/Container/ConfigProvider.php b/packages/toggle-core/src/Container/ConfigProvider.php
deleted file mode 100644
index f941a2d..0000000
--- a/packages/toggle-core/src/Container/ConfigProvider.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Pheature\Core\Toggle\Container;
-
-use Pheature\Core\Toggle\Read\ChainToggleStrategyFactory;
-use Pheature\Core\Toggle\Read\FeatureFinder;
-use Pheature\Core\Toggle\Read\Toggle;
-use Pheature\Core\Toggle\Write\FeatureRepository;
-use Pheature\Crud\Psr11\Toggle\FeatureFinderFactory;
-use Pheature\Crud\Psr11\Toggle\FeatureRepositoryFactory;
-use Pheature\Crud\Psr11\Toggle\ToggleFactory;
-
-final class ConfigProvider
-{
-    /**
-     * @return array<string, array<string, array<string, string>>>
-     */
-    public function __invoke(): array
-    {
-        return [
-            'dependencies' => [
-                'factories' => [
-                    FeatureFinder::class => FeatureFinderFactory::class,
-                    Toggle::class => ToggleFactory::class,
-                    FeatureRepository::class => FeatureRepositoryFactory::class,
-                    ChainToggleStrategyFactory::class => \Pheature\Crud\Psr11\Toggle\ChainToggleStrategyFactory::class,
-                ],
-            ],
-        ];
-    }
-}
diff --git a/packages/toggle-crud-psr11-factories/composer.json b/packages/toggle-crud-psr11-factories/composer.json
index c0b4199..946d9f7 100644
--- a/packages/toggle-crud-psr11-factories/composer.json
+++ b/packages/toggle-crud-psr11-factories/composer.json
@@ -18,15 +18,15 @@
     "require": {
         "php": "^7.4|^8.0",
         "pheature/toggle-core": "^0.1.1",
-        "pheature/toggle-model": "^0.1.1",
-        "pheature/toggle-crud": "^0.1.1",
-        "pheature/toggle-crud-psr7-api": "^0.1.1"
+        "pheature/toggle-model": "^0.1.1"
     },
     "require-dev": {
+        "icanhazstring/composer-unused": "^0.7.5",
         "infection/infection": "^0.23.0",
         "pheature/dbal-toggle": "^0.1.1",
         "pheature/inmemory-toggle": "^0.1.1",
         "pheature/php-sdk": "^0.1.1",
+        "pheature/toggle-crud": "^0.1.1",
         "phpro/grumphp": "^1.0",
         "phpstan/phpstan": "^0.12",
         "phpunit/phpunit": "^8.0 || ^9.0",
@@ -47,6 +47,7 @@
     },
     "scripts": {
         "check-all": [
+            "composer unused",
             "@cs-check",
             "@test",
             "@inspect",
diff --git a/packages/toggle-crud-psr11-factories/src/ChainToggleStrategyFactory.php b/packages/toggle-crud-psr11-factories/src/ChainToggleStrategyFactoryFactory.php
similarity index 59%
rename from packages/toggle-crud-psr11-factories/src/ChainToggleStrategyFactory.php
rename to packages/toggle-crud-psr11-factories/src/ChainToggleStrategyFactoryFactory.php
index 53a3580..eaf8cd7 100644
--- a/packages/toggle-crud-psr11-factories/src/ChainToggleStrategyFactory.php
+++ b/packages/toggle-crud-psr11-factories/src/ChainToggleStrategyFactoryFactory.php
@@ -5,16 +5,16 @@ declare(strict_types=1);
 namespace Pheature\Crud\Psr11\Toggle;
 
 use Pheature\Core\Toggle\Read\ToggleStrategyFactory;
-use Pheature\Model\Toggle\SegmentFactory as ModelSegmentFactory;
+use Pheature\Model\Toggle\SegmentFactory;
 use Psr\Container\ContainerInterface;
-use Pheature\Core\Toggle\Read\ChainToggleStrategyFactory as ReadToggleStrategyFactory;
+use Pheature\Core\Toggle\Read\ChainToggleStrategyFactory;
 
-class ChainToggleStrategyFactory
+class ChainToggleStrategyFactoryFactory
 {
-    public function __invoke(ContainerInterface $container): ReadToggleStrategyFactory
+    public function __invoke(ContainerInterface $container): ChainToggleStrategyFactory
     {
-        /** @var ModelSegmentFactory $segmentFactory */
-        $segmentFactory = $container->get(ModelSegmentFactory::class);
+        /** @var SegmentFactory $segmentFactory */
+        $segmentFactory = $container->get(SegmentFactory::class);
         /** @var ToggleConfig $toggleConfig */
         $toggleConfig = $container->get(ToggleConfig::class);
 
@@ -33,9 +33,9 @@ class ChainToggleStrategyFactory
     }
 
     public static function create(
-        ModelSegmentFactory $segmentFactory,
+        SegmentFactory $segmentFactory,
         ToggleStrategyFactory ...$toggleStrategyFactories
-    ): ReadToggleStrategyFactory {
-        return new ReadToggleStrategyFactory($segmentFactory, ...$toggleStrategyFactories);
+    ): ChainToggleStrategyFactory {
+        return new ChainToggleStrategyFactory($segmentFactory, ...$toggleStrategyFactories);
     }
 }
diff --git a/packages/toggle-crud-psr11-factories/src/Container/ConfigProvider.php b/packages/toggle-crud-psr11-factories/src/Container/ConfigProvider.php
index f8c3f7e..7b13d02 100644
--- a/packages/toggle-crud-psr11-factories/src/Container/ConfigProvider.php
+++ b/packages/toggle-crud-psr11-factories/src/Container/ConfigProvider.php
@@ -4,8 +4,16 @@ declare(strict_types=1);
 
 namespace Pheature\Crud\Psr11\Toggle\Container;
 
+use Pheature\Core\Toggle\Read\ChainToggleStrategyFactory;
+use Pheature\Core\Toggle\Read\FeatureFinder;
+use Pheature\Core\Toggle\Read\Toggle;
+use Pheature\Core\Toggle\Write\FeatureRepository;
+use Pheature\Crud\Psr11\Toggle\ChainToggleStrategyFactoryFactory;
+use Pheature\Crud\Psr11\Toggle\FeatureFinderFactory;
+use Pheature\Crud\Psr11\Toggle\FeatureRepositoryFactory;
 use Pheature\Crud\Psr11\Toggle\ToggleConfigFactory;
 use Pheature\Crud\Psr11\Toggle\ToggleConfig;
+use Pheature\Crud\Psr11\Toggle\ToggleFactory;
 
 final class ConfigProvider
 {
@@ -18,6 +26,10 @@ final class ConfigProvider
             'dependencies' => [
                 'factories' => [
                     ToggleConfig::class => ToggleConfigFactory::class,
+                    FeatureFinder::class => FeatureFinderFactory::class,
+                    Toggle::class => ToggleFactory::class,
+                    FeatureRepository::class => FeatureRepositoryFactory::class,
+                    ChainToggleStrategyFactory::class => ChainToggleStrategyFactoryFactory::class,
                 ],
             ],
         ];
diff --git a/packages/toggle-crud-psr7-api/composer.json b/packages/toggle-crud-psr7-api/composer.json
index 8969529..5cec123 100644
--- a/packages/toggle-crud-psr7-api/composer.json
+++ b/packages/toggle-crud-psr7-api/composer.json
@@ -26,6 +26,7 @@
         "webmozart/assert": "^1.10"
     },
     "require-dev": {
+        "icanhazstring/composer-unused": "^0.7.5",
         "infection/infection": "^0.23.0",
         "phpro/grumphp": "^1.0",
         "phpstan/phpstan": "^0.12",
@@ -47,6 +48,7 @@
     },
     "scripts": {
         "check-all": [
+            "composer unused",
             "@cs-check",
             "@test",
             "@inspect",
diff --git a/packages/toggle-crud/composer.json b/packages/toggle-crud/composer.json
index fb86066..edbce3b 100644
--- a/packages/toggle-crud/composer.json
+++ b/packages/toggle-crud/composer.json
@@ -17,10 +17,10 @@
     ],
     "require": {
         "php": "^7.4|^8.0",
-        "pheature/toggle-core": "^0.1.1",
-        "pheature/toggle-model": "^0.1.1"
+        "pheature/toggle-core": "^0.1.1"
     },
     "require-dev": {
+        "icanhazstring/composer-unused": "^0.7.5",
         "infection/infection": "^0.23.0",
         "phpro/grumphp": "^1.0",
         "phpstan/phpstan": "^0.12",
@@ -42,6 +42,7 @@
     },
     "scripts": {
         "check-all": [
+            "composer unused",
             "@cs-check",
             "@test",
             "@inspect",
diff --git a/packages/toggle-crud/src/Container/ConfigProvider.php b/packages/toggle-crud/src/Container/ConfigProvider.php
index e91386f..5311112 100644
--- a/packages/toggle-crud/src/Container/ConfigProvider.php
+++ b/packages/toggle-crud/src/Container/ConfigProvider.php
@@ -4,12 +4,12 @@ declare(strict_types=1);
 
 namespace Pheature\Crud\Toggle\Container;
 
-use Pheature\Crud\Psr11\Toggle\CreateFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\DisableFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\EnableFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\RemoveFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\RemoveStrategyFactory;
-use Pheature\Crud\Psr11\Toggle\SetStrategyFactory;
+use Pheature\Crud\Toggle\Handler\CreateFeatureFactory;
+use Pheature\Crud\Toggle\Handler\DisableFeatureFactory;
+use Pheature\Crud\Toggle\Handler\EnableFeatureFactory;
+use Pheature\Crud\Toggle\Handler\RemoveFeatureFactory;
+use Pheature\Crud\Toggle\Handler\RemoveStrategyFactory;
+use Pheature\Crud\Toggle\Handler\SetStrategyFactory;
 use Pheature\Crud\Toggle\Handler\CreateFeature;
 use Pheature\Crud\Toggle\Handler\DisableFeature;
 use Pheature\Crud\Toggle\Handler\EnableFeature;
diff --git a/packages/toggle-crud-psr11-factories/src/CreateFeatureFactory.php b/packages/toggle-crud/src/Handler/CreateFeatureFactory.php
similarity index 94%
rename from packages/toggle-crud-psr11-factories/src/CreateFeatureFactory.php
rename to packages/toggle-crud/src/Handler/CreateFeatureFactory.php
index 6cd9ac0..5528ea9 100644
--- a/packages/toggle-crud-psr11-factories/src/CreateFeatureFactory.php
+++ b/packages/toggle-crud/src/Handler/CreateFeatureFactory.php
@@ -2,7 +2,7 @@
 
 declare(strict_types=1);
 
-namespace Pheature\Crud\Psr11\Toggle;
+namespace Pheature\Crud\Toggle\Handler;
 
 use Pheature\Core\Toggle\Write\FeatureRepository;
 use Pheature\Crud\Toggle\Handler\CreateFeature;
diff --git a/packages/toggle-crud-psr11-factories/src/DisableFeatureFactory.php b/packages/toggle-crud/src/Handler/DisableFeatureFactory.php
similarity index 94%
rename from packages/toggle-crud-psr11-factories/src/DisableFeatureFactory.php
rename to packages/toggle-crud/src/Handler/DisableFeatureFactory.php
index 0770320..6054bc3 100644
--- a/packages/toggle-crud-psr11-factories/src/DisableFeatureFactory.php
+++ b/packages/toggle-crud/src/Handler/DisableFeatureFactory.php
@@ -2,7 +2,7 @@
 
 declare(strict_types=1);
 
-namespace Pheature\Crud\Psr11\Toggle;
+namespace Pheature\Crud\Toggle\Handler;
 
 use Pheature\Core\Toggle\Write\FeatureRepository;
 use Pheature\Crud\Toggle\Handler\DisableFeature;
diff --git a/packages/toggle-crud-psr11-factories/src/EnableFeatureFactory.php b/packages/toggle-crud/src/Handler/EnableFeatureFactory.php
similarity index 94%
rename from packages/toggle-crud-psr11-factories/src/EnableFeatureFactory.php
rename to packages/toggle-crud/src/Handler/EnableFeatureFactory.php
index 4100e1b..f22a431 100644
--- a/packages/toggle-crud-psr11-factories/src/EnableFeatureFactory.php
+++ b/packages/toggle-crud/src/Handler/EnableFeatureFactory.php
@@ -2,7 +2,7 @@
 
 declare(strict_types=1);
 
-namespace Pheature\Crud\Psr11\Toggle;
+namespace Pheature\Crud\Toggle\Handler;
 
 use Pheature\Core\Toggle\Write\FeatureRepository;
 use Pheature\Crud\Toggle\Handler\EnableFeature;
diff --git a/packages/toggle-crud-psr11-factories/src/RemoveFeatureFactory.php b/packages/toggle-crud/src/Handler/RemoveFeatureFactory.php
similarity index 94%
rename from packages/toggle-crud-psr11-factories/src/RemoveFeatureFactory.php
rename to packages/toggle-crud/src/Handler/RemoveFeatureFactory.php
index 120bbb0..c523e6a 100644
--- a/packages/toggle-crud-psr11-factories/src/RemoveFeatureFactory.php
+++ b/packages/toggle-crud/src/Handler/RemoveFeatureFactory.php
@@ -2,7 +2,7 @@
 
 declare(strict_types=1);
 
-namespace Pheature\Crud\Psr11\Toggle;
+namespace Pheature\Crud\Toggle\Handler;
 
 use Pheature\Core\Toggle\Write\FeatureRepository;
 use Pheature\Crud\Toggle\Handler\RemoveFeature;
diff --git a/packages/toggle-crud-psr11-factories/src/RemoveStrategyFactory.php b/packages/toggle-crud/src/Handler/RemoveStrategyFactory.php
similarity index 94%
rename from packages/toggle-crud-psr11-factories/src/RemoveStrategyFactory.php
rename to packages/toggle-crud/src/Handler/RemoveStrategyFactory.php
index b5d3c05..7223fa0 100644
--- a/packages/toggle-crud-psr11-factories/src/RemoveStrategyFactory.php
+++ b/packages/toggle-crud/src/Handler/RemoveStrategyFactory.php
@@ -2,7 +2,7 @@
 
 declare(strict_types=1);
 
-namespace Pheature\Crud\Psr11\Toggle;
+namespace Pheature\Crud\Toggle\Handler;
 
 use Pheature\Core\Toggle\Write\FeatureRepository;
 use Pheature\Crud\Toggle\Handler\RemoveStrategy;
diff --git a/packages/toggle-crud-psr11-factories/src/SetStrategyFactory.php b/packages/toggle-crud/src/Handler/SetStrategyFactory.php
similarity index 93%
rename from packages/toggle-crud-psr11-factories/src/SetStrategyFactory.php
rename to packages/toggle-crud/src/Handler/SetStrategyFactory.php
index 795205f..5aadff7 100644
--- a/packages/toggle-crud-psr11-factories/src/SetStrategyFactory.php
+++ b/packages/toggle-crud/src/Handler/SetStrategyFactory.php
@@ -2,7 +2,7 @@
 
 declare(strict_types=1);
 
-namespace Pheature\Crud\Psr11\Toggle;
+namespace Pheature\Crud\Toggle\Handler;
 
 use Pheature\Core\Toggle\Write\FeatureRepository;
 use Pheature\Crud\Toggle\Handler\SetStrategy;
diff --git a/packages/toggle-model/composer.json b/packages/toggle-model/composer.json
index 26a0336..1e0227a 100644
--- a/packages/toggle-model/composer.json
+++ b/packages/toggle-model/composer.json
@@ -20,6 +20,7 @@
         "pheature/toggle-core": "^0.1.1"
     },
     "require-dev": {
+        "icanhazstring/composer-unused": "^0.7.5",
         "infection/infection": "^0.23.0",
         "phpro/grumphp": "^1.0",
         "phpstan/phpstan": "^0.12",
@@ -41,6 +42,7 @@
     },
     "scripts": {
         "check-all": [
+            "composer unused",
             "@cs-check",
             "@test",
             "@inspect",
diff --git a/packages/toggle-model/src/Container/ConfigProvider.php b/packages/toggle-model/src/Container/ConfigProvider.php
index 5f24580..98fe463 100644
--- a/packages/toggle-model/src/Container/ConfigProvider.php
+++ b/packages/toggle-model/src/Container/ConfigProvider.php
@@ -5,7 +5,9 @@ declare(strict_types=1);
 namespace Pheature\Model\Toggle\Container;
 
 use Pheature\Model\Toggle\SegmentFactory;
+use Pheature\Model\Toggle\SegmentFactoryFactory;
 use Pheature\Model\Toggle\StrategyFactory;
+use Pheature\Model\Toggle\StrategyFactoryFactory;
 
 final class ConfigProvider
 {
@@ -17,8 +19,8 @@ final class ConfigProvider
         return [
             'dependencies' => [
                 'factories' => [
-                    StrategyFactory::class => \Pheature\Crud\Psr11\Toggle\StrategyFactory::class,
-                    SegmentFactory::class => \Pheature\Crud\Psr11\Toggle\SegmentFactory::class,
+                    StrategyFactory::class => StrategyFactoryFactory::class,
+                    SegmentFactory::class => SegmentFactoryFactory::class,
                 ],
             ],
         ];
diff --git a/packages/toggle-crud-psr11-factories/src/SegmentFactory.php b/packages/toggle-model/src/SegmentFactoryFactory.php
similarity index 58%
rename from packages/toggle-crud-psr11-factories/src/SegmentFactory.php
rename to packages/toggle-model/src/SegmentFactoryFactory.php
index 331c4f5..5150750 100644
--- a/packages/toggle-crud-psr11-factories/src/SegmentFactory.php
+++ b/packages/toggle-model/src/SegmentFactoryFactory.php
@@ -2,16 +2,16 @@
 
 declare(strict_types=1);
 
-namespace Pheature\Crud\Psr11\Toggle;
+namespace Pheature\Model\Toggle;
 
-use Pheature\Model\Toggle\SegmentFactory as ModelSegmentFactory;
+use Pheature\Model\Toggle\SegmentFactory;
 use Psr\Container\ContainerInterface;
 use Pheature\Core\Toggle\Read\SegmentFactory as ReadSegmentFactory;
 
-class SegmentFactory
+class SegmentFactoryFactory
 {
     public function __invoke(ContainerInterface $container): ReadSegmentFactory
     {
-        return new ModelSegmentFactory();
+        return new SegmentFactory();
     }
 }
diff --git a/packages/toggle-crud-psr11-factories/src/StrategyFactory.php b/packages/toggle-model/src/StrategyFactoryFactory.php
similarity index 56%
rename from packages/toggle-crud-psr11-factories/src/StrategyFactory.php
rename to packages/toggle-model/src/StrategyFactoryFactory.php
index 90f117c..2d3f4b1 100644
--- a/packages/toggle-crud-psr11-factories/src/StrategyFactory.php
+++ b/packages/toggle-model/src/StrategyFactoryFactory.php
@@ -2,16 +2,16 @@
 
 declare(strict_types=1);
 
-namespace Pheature\Crud\Psr11\Toggle;
+namespace Pheature\Model\Toggle;
 
 use Pheature\Core\Toggle\Read\ToggleStrategyFactory;
-use Pheature\Model\Toggle\StrategyFactory as ModelStrategyFactory;
+use Pheature\Model\Toggle\StrategyFactory;
 use Psr\Container\ContainerInterface;
 
-final class StrategyFactory
+final class StrategyFactoryFactory
 {
     public function __invoke(ContainerInterface $container): ToggleStrategyFactory
     {
-        return new ModelStrategyFactory();
+        return new StrategyFactory();
     }
 }


Test patch:
diff --git a/packages/toggle-crud-psr11-factories/test/CommandRunnerFactoryTest.php b/packages/php-sdk/test/CommandRunnerFactoryTest.php
similarity index 91%
rename from packages/toggle-crud-psr11-factories/test/CommandRunnerFactoryTest.php
rename to packages/php-sdk/test/CommandRunnerFactoryTest.php
index da6b599..ece5794 100644
--- a/packages/toggle-crud-psr11-factories/test/CommandRunnerFactoryTest.php
+++ b/packages/php-sdk/test/CommandRunnerFactoryTest.php
@@ -2,13 +2,12 @@
 
 declare(strict_types=1);
 
-namespace Pheature\Test\Crud\Psr11\Toggle;
+namespace Pheature\Test\Sdk;
 
 use Exception;
 use Pheature\Core\Toggle\Read\FeatureFinder;
-use Pheature\Crud\Psr11\Toggle\CommandRunnerFactory;
 use Pheature\Sdk\CommandRunner;
-use Pheature\Test\Community\Mezzio\Fixtures\TestContainerFactory;
+use Pheature\Sdk\CommandRunnerFactory;
 use PHPUnit\Framework\MockObject\MockObject;
 use PHPUnit\Framework\TestCase;
 use Psr\Container\ContainerInterface;
diff --git a/packages/php-sdk/test/Container/ConfigProviderTest.php b/packages/php-sdk/test/Container/ConfigProviderTest.php
index 254d7eb..4ab5a84 100644
--- a/packages/php-sdk/test/Container/ConfigProviderTest.php
+++ b/packages/php-sdk/test/Container/ConfigProviderTest.php
@@ -4,8 +4,8 @@ declare(strict_types=1);
 
 namespace Pheature\Test\Sdk\Container;
 
-use Pheature\Crud\Psr11\Toggle\CommandRunnerFactory;
 use Pheature\Sdk\CommandRunner;
+use Pheature\Sdk\CommandRunnerFactory;
 use Pheature\Sdk\Container\ConfigProvider;
 use PHPUnit\Framework\TestCase;
 
diff --git a/packages/toggle-core/test/Container/ConfigProviderTest.php b/packages/toggle-core/test/Container/ConfigProviderTest.php
deleted file mode 100644
index d613528..0000000
--- a/packages/toggle-core/test/Container/ConfigProviderTest.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Pheature\Test\Core\Toggle\Container;
-
-use Pheature\Core\Toggle\Container\ConfigProvider;
-use Pheature\Core\Toggle\Read\ChainToggleStrategyFactory;
-use Pheature\Core\Toggle\Read\FeatureFinder;
-use Pheature\Core\Toggle\Read\Toggle;
-use Pheature\Core\Toggle\Write\FeatureRepository;
-use Pheature\Crud\Psr11\Toggle\FeatureFinderFactory;
-use Pheature\Crud\Psr11\Toggle\FeatureRepositoryFactory;
-use Pheature\Crud\Psr11\Toggle\ToggleFactory;
-use PHPUnit\Framework\TestCase;
-
-final class ConfigProviderTest extends TestCase
-{
-    private const EXPECTED_CONFIG = [
-        'dependencies' => [
-            'factories' => [
-                FeatureFinder::class => FeatureFinderFactory::class,
-                Toggle::class => ToggleFactory::class,
-                FeatureRepository::class => FeatureRepositoryFactory::class,
-                ChainToggleStrategyFactory::class => \Pheature\Crud\Psr11\Toggle\ChainToggleStrategyFactory::class,
-            ],
-        ],
-    ];
-
-    public function testItShouldCreateTheCorrectConfiguration(): void
-    {
-        $actual = (new ConfigProvider())->__invoke();
-
-        self::assertSame(self::EXPECTED_CONFIG, $actual);
-    }
-}
diff --git a/packages/toggle-crud-psr11-factories/test/Container/ConfigProviderTest.php b/packages/toggle-crud-psr11-factories/test/Container/ConfigProviderTest.php
index e3149c9..031ae71 100644
--- a/packages/toggle-crud-psr11-factories/test/Container/ConfigProviderTest.php
+++ b/packages/toggle-crud-psr11-factories/test/Container/ConfigProviderTest.php
@@ -4,9 +4,17 @@ declare(strict_types=1);
 
 namespace Pheature\Test\Crud\Psr11\Toggle\Container;
 
+use Pheature\Core\Toggle\Read\ChainToggleStrategyFactory;
+use Pheature\Core\Toggle\Read\FeatureFinder;
+use Pheature\Core\Toggle\Read\Toggle;
+use Pheature\Core\Toggle\Write\FeatureRepository;
+use Pheature\Crud\Psr11\Toggle\ChainToggleStrategyFactoryFactory;
+use Pheature\Crud\Psr11\Toggle\FeatureFinderFactory;
+use Pheature\Crud\Psr11\Toggle\FeatureRepositoryFactory;
 use Pheature\Crud\Psr11\Toggle\ToggleConfigFactory;
 use Pheature\Crud\Psr11\Toggle\Container\ConfigProvider;
 use Pheature\Crud\Psr11\Toggle\ToggleConfig;
+use Pheature\Crud\Psr11\Toggle\ToggleFactory;
 use PHPUnit\Framework\TestCase;
 
 final class ConfigProviderTest extends TestCase
@@ -15,6 +23,10 @@ final class ConfigProviderTest extends TestCase
         'dependencies' => [
             'factories' => [
                 ToggleConfig::class => ToggleConfigFactory::class,
+                FeatureFinder::class => FeatureFinderFactory::class,
+                Toggle::class => ToggleFactory::class,
+                FeatureRepository::class => FeatureRepositoryFactory::class,
+                ChainToggleStrategyFactory::class => ChainToggleStrategyFactoryFactory::class,
             ],
         ],
     ];
diff --git a/packages/toggle-crud/test/Container/ConfigProviderTest.php b/packages/toggle-crud/test/Container/ConfigProviderTest.php
index fbec536..d23ffa1 100644
--- a/packages/toggle-crud/test/Container/ConfigProviderTest.php
+++ b/packages/toggle-crud/test/Container/ConfigProviderTest.php
@@ -4,12 +4,12 @@ declare(strict_types=1);
 
 namespace Pheature\Test\Crud\Toggle\Container;
 
-use Pheature\Crud\Psr11\Toggle\CreateFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\DisableFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\EnableFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\RemoveFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\RemoveStrategyFactory;
-use Pheature\Crud\Psr11\Toggle\SetStrategyFactory;
+use Pheature\Crud\Toggle\Handler\CreateFeatureFactory;
+use Pheature\Crud\Toggle\Handler\DisableFeatureFactory;
+use Pheature\Crud\Toggle\Handler\EnableFeatureFactory;
+use Pheature\Crud\Toggle\Handler\RemoveFeatureFactory;
+use Pheature\Crud\Toggle\Handler\RemoveStrategyFactory;
+use Pheature\Crud\Toggle\Handler\SetStrategyFactory;
 use Pheature\Crud\Toggle\Container\ConfigProvider;
 use Pheature\Crud\Toggle\Handler\CreateFeature;
 use Pheature\Crud\Toggle\Handler\DisableFeature;
diff --git a/packages/toggle-crud-psr11-factories/test/CreateFeatureFactoryTest.php b/packages/toggle-crud/test/Handler/CreateFeatureFactoryTest.php
similarity index 91%
rename from packages/toggle-crud-psr11-factories/test/CreateFeatureFactoryTest.php
rename to packages/toggle-crud/test/Handler/CreateFeatureFactoryTest.php
index d128f94..7977f56 100644
--- a/packages/toggle-crud-psr11-factories/test/CreateFeatureFactoryTest.php
+++ b/packages/toggle-crud/test/Handler/CreateFeatureFactoryTest.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Pheature\Test\Crud\Psr11\Toggle;
+namespace Pheature\Test\Crud\Toggle\Handler;
 
 use Pheature\Core\Toggle\Write\FeatureRepository;
-use Pheature\Crud\Psr11\Toggle\CreateFeatureFactory;
+use Pheature\Crud\Toggle\Handler\CreateFeatureFactory;
 use Pheature\Crud\Toggle\Handler\CreateFeature;
 use Psr\Container\ContainerInterface;
 use PHPUnit\Framework\TestCase;
diff --git a/packages/toggle-crud-psr11-factories/test/DisableFeatureFactoryTest.php b/packages/toggle-crud/test/Handler/DisableFeatureFactoryTest.php
similarity index 91%
rename from packages/toggle-crud-psr11-factories/test/DisableFeatureFactoryTest.php
rename to packages/toggle-crud/test/Handler/DisableFeatureFactoryTest.php
index 7f5e7be..d1a736d 100644
--- a/packages/toggle-crud-psr11-factories/test/DisableFeatureFactoryTest.php
+++ b/packages/toggle-crud/test/Handler/DisableFeatureFactoryTest.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Pheature\Test\Crud\Psr11\Toggle;
+namespace Pheature\Test\Crud\Toggle\Handler;
 
 use Pheature\Core\Toggle\Write\FeatureRepository;
-use Pheature\Crud\Psr11\Toggle\DisableFeatureFactory;
+use Pheature\Crud\Toggle\Handler\DisableFeatureFactory;
 use Pheature\Crud\Toggle\Handler\DisableFeature;
 use Psr\Container\ContainerInterface;
 use PHPUnit\Framework\TestCase;
diff --git a/packages/toggle-crud-psr11-factories/test/RemoveFeatureFactoryTest.php b/packages/toggle-crud/test/Handler/RemoveFeatureFactoryTest.php
similarity index 90%
rename from packages/toggle-crud-psr11-factories/test/RemoveFeatureFactoryTest.php
rename to packages/toggle-crud/test/Handler/RemoveFeatureFactoryTest.php
index 5713dc3..991f4b5 100644
--- a/packages/toggle-crud-psr11-factories/test/RemoveFeatureFactoryTest.php
+++ b/packages/toggle-crud/test/Handler/RemoveFeatureFactoryTest.php
@@ -1,10 +1,10 @@
 <?php
 declare(strict_types=1);
 
-namespace Pheature\Test\Crud\Psr11\Toggle;
+namespace Pheature\Test\Crud\Toggle\Handler;
 
 use Pheature\Core\Toggle\Write\FeatureRepository;
-use Pheature\Crud\Psr11\Toggle\RemoveFeatureFactory;
+use Pheature\Crud\Toggle\Handler\RemoveFeatureFactory;
 use Pheature\Crud\Toggle\Handler\RemoveFeature;
 use PHPUnit\Framework\TestCase;
 use Psr\Container\ContainerInterface;
diff --git a/packages/toggle-crud-psr11-factories/test/RemoveStrategyFactoryTest.php b/packages/toggle-crud/test/Handler/RemoveStrategyFactoryTest.php
similarity index 89%
rename from packages/toggle-crud-psr11-factories/test/RemoveStrategyFactoryTest.php
rename to packages/toggle-crud/test/Handler/RemoveStrategyFactoryTest.php
index d60d323..a9db688 100644
--- a/packages/toggle-crud-psr11-factories/test/RemoveStrategyFactoryTest.php
+++ b/packages/toggle-crud/test/Handler/RemoveStrategyFactoryTest.php
@@ -1,9 +1,9 @@
 <?php
 
-namespace Pheature\Test\Crud\Psr11\Toggle;
+namespace Pheature\Test\Crud\Toggle\Handler;
 
 use Pheature\Core\Toggle\Write\FeatureRepository;
-use Pheature\Crud\Psr11\Toggle\RemoveStrategyFactory;
+use Pheature\Crud\Toggle\Handler\RemoveStrategyFactory;
 use Pheature\Crud\Toggle\Handler\RemoveStrategy;
 use PHPUnit\Framework\TestCase;
 use Psr\Container\ContainerInterface;
diff --git a/packages/toggle-crud-psr11-factories/test/SetStrategyFactoryTest.php b/packages/toggle-crud/test/Handler/SetStrategyFactoryTest.php
similarity index 91%
rename from packages/toggle-crud-psr11-factories/test/SetStrategyFactoryTest.php
rename to packages/toggle-crud/test/Handler/SetStrategyFactoryTest.php
index 542a78b..8fe6010 100644
--- a/packages/toggle-crud-psr11-factories/test/SetStrategyFactoryTest.php
+++ b/packages/toggle-crud/test/Handler/SetStrategyFactoryTest.php
@@ -2,10 +2,10 @@
 
 declare(strict_types=1);
 
-namespace Pheature\Test\Crud\Psr11\Toggle;
+namespace Pheature\Test\Crud\Toggle\Handler;
 
 use Pheature\Core\Toggle\Write\FeatureRepository;
-use Pheature\Crud\Psr11\Toggle\SetStrategyFactory;
+use Pheature\Crud\Toggle\Handler\SetStrategyFactory;
 use Pheature\Crud\Toggle\Handler\SetStrategy;
 use PHPUnit\Framework\TestCase;
 use Psr\Container\ContainerInterface;
diff --git a/packages/toggle-model/test/Container/ConfigProviderTest.php b/packages/toggle-model/test/Container/ConfigProviderTest.php
index e9ebd74..9d30e0c 100644
--- a/packages/toggle-model/test/Container/ConfigProviderTest.php
+++ b/packages/toggle-model/test/Container/ConfigProviderTest.php
@@ -6,7 +6,9 @@ namespace Pheature\Test\Model\Toggle\Container;
 
 use Pheature\Model\Toggle\Container\ConfigProvider;
 use Pheature\Model\Toggle\SegmentFactory;
+use Pheature\Model\Toggle\SegmentFactoryFactory;
 use Pheature\Model\Toggle\StrategyFactory;
+use Pheature\Model\Toggle\StrategyFactoryFactory;
 use PHPUnit\Framework\TestCase;
 
 final class ConfigProviderTest extends TestCase
@@ -14,8 +16,8 @@ final class ConfigProviderTest extends TestCase
     private const EXPECTED_CONFIG = [
         'dependencies' => [
             'factories' => [
-                StrategyFactory::class => \Pheature\Crud\Psr11\Toggle\StrategyFactory::class,
-                SegmentFactory::class => \Pheature\Crud\Psr11\Toggle\SegmentFactory::class,
+                StrategyFactory::class => StrategyFactoryFactory::class,
+                SegmentFactory::class => SegmentFactoryFactory::class,
             ],
         ],
     ];