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:
[#261] [mezzio-toggle] Make as optional the installation of some pheature packages
It closes #261 

Patch:
diff --git a/composer.json b/composer.json
index 1b4bb37..ee15a27 100644
--- a/composer.json
+++ b/composer.json
@@ -69,7 +69,7 @@
             "Pheature\\Test\\InMemory\\Toggle\\": "packages/inmemory-toggle/test",
             "Pheature\\Test\\Model\\Toggle\\": "packages/toggle-model/test",
             "Symplify\\Tests\\": "tests",
-            "Test\\Pheature\\Sdk\\": "packages/php-sdk/test"
+            "Pheature\\Test\\Sdk\\": "packages/php-sdk/test"
         }
     },
     "scripts": {
diff --git a/packages/dbal-toggle/composer.json b/packages/dbal-toggle/composer.json
index 8eb742c..d717179 100644
--- a/packages/dbal-toggle/composer.json
+++ b/packages/dbal-toggle/composer.json
@@ -7,6 +7,12 @@
     "authors": [
         {
             "name": "kpicaza"
+        },
+        {
+            "name": "pcs289"
+        },
+        {
+            "name": "xserrat"
         }
     ],
     "require": {
@@ -57,7 +63,7 @@
     },
     "extra": {
         "laminas": {
-            "config-provider": "Pheature\\Test\\Dbal\\Toggle\\Container\\ConfigProvider"
+            "config-provider": "Pheature\\Dbal\\Toggle\\Container\\ConfigProvider"
         }
     }
 }
diff --git a/packages/inmemory-toggle/composer.json b/packages/inmemory-toggle/composer.json
index 4891472..622cbd4 100644
--- a/packages/inmemory-toggle/composer.json
+++ b/packages/inmemory-toggle/composer.json
@@ -7,6 +7,12 @@
     "authors": [
         {
             "name": "kpicaza"
+        },
+        {
+            "name": "pcs289"
+        },
+        {
+            "name": "xserrat"
         }
     ],
     "require": {
diff --git a/packages/inmemory-toggle/src/InMemoryFeatureFactory.php b/packages/inmemory-toggle/src/InMemoryFeatureFactory.php
index 14438c8..bad8ae1 100644
--- a/packages/inmemory-toggle/src/InMemoryFeatureFactory.php
+++ b/packages/inmemory-toggle/src/InMemoryFeatureFactory.php
@@ -28,7 +28,7 @@ final class InMemoryFeatureFactory
         $id = $data['id'];
         $enabled = (bool)$data['enabled'];
         /** @var array<string, array<string, mixed>> $strategies */
-        $strategies = $data['strategies'];
+        $strategies = $data['strategies'] ?? [];
         return new Feature(
             $id,
             /** @param array<string, array<string, mixed>> $strategies */
diff --git a/packages/laravel-toggle/composer.json b/packages/laravel-toggle/composer.json
index 2e3392a..3d72972 100644
--- a/packages/laravel-toggle/composer.json
+++ b/packages/laravel-toggle/composer.json
@@ -7,6 +7,12 @@
     "authors": [
         {
             "name": "kpicaza"
+        },
+        {
+            "name": "pcs289"
+        },
+        {
+            "name": "xserrat"
         }
     ],
     "require": {
diff --git a/packages/mezzio-toggle/composer.json b/packages/mezzio-toggle/composer.json
index cdad025..da5c48e 100644
--- a/packages/mezzio-toggle/composer.json
+++ b/packages/mezzio-toggle/composer.json
@@ -20,11 +20,7 @@
         "laminas/laminas-diactoros": "^2.6",
         "mezzio/mezzio": "^3.3",
         "mezzio/mezzio-helpers": "^5.4",
-        "pheature/inmemory-toggle": "^0.1.1",
-        "pheature/php-sdk": "^0.1.1",
         "pheature/toggle-core": "^0.1.1",
-        "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"
     },
@@ -36,7 +32,8 @@
         "roave/infection-static-analysis-plugin": "^1.8",
         "squizlabs/php_codesniffer": "^3.4",
         "symfony/var-dumper": "^4.2 || ^5.0",
-        "vimeo/psalm": "^4.4"
+        "vimeo/psalm": "^4.4",
+        "pheature/php-sdk": "^0.1.1"
     },
     "autoload": {
         "psr-4": {
diff --git a/packages/mezzio-toggle/src/ToggleConfigProvider.php b/packages/mezzio-toggle/src/ToggleConfigProvider.php
index e068448..8f0360f 100644
--- a/packages/mezzio-toggle/src/ToggleConfigProvider.php
+++ b/packages/mezzio-toggle/src/ToggleConfigProvider.php
@@ -5,41 +5,12 @@ declare(strict_types=1);
 namespace Pheature\Community\Mezzio;
 
 use Mezzio\Application;
-use Pheature\Core\Toggle\Read\ChainToggleStrategyFactory;
-use Pheature\Core\Toggle\Read\FeatureFinder;
-use Pheature\Core\Toggle\Write\FeatureRepository;
-use Pheature\Crud\Psr11\Toggle\SetStrategyFactory;
-use Pheature\Crud\Psr11\Toggle\CreateFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\DeleteFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\DisableFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\EnableFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\FeatureFinderFactory;
-use Pheature\Crud\Psr11\Toggle\FeatureRepositoryFactory;
-use Pheature\Crud\Psr11\Toggle\GetFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\GetFeaturesFactory;
-use Pheature\Crud\Psr11\Toggle\PatchFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\PostFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\RemoveFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\RemoveStrategyFactory;
-use Pheature\Crud\Psr11\Toggle\ToggleConfig;
-use Pheature\Crud\Psr7\Toggle\DeleteFeature;
-use Pheature\Crud\Psr7\Toggle\GetFeature;
-use Pheature\Crud\Psr7\Toggle\GetFeatures;
-use Pheature\Crud\Psr7\Toggle\PatchFeature;
-use Pheature\Crud\Psr7\Toggle\PostFeature;
-use Pheature\Crud\Toggle\Handler\SetStrategy;
-use Pheature\Crud\Toggle\Handler\CreateFeature;
-use Pheature\Crud\Toggle\Handler\DisableFeature;
-use Pheature\Crud\Toggle\Handler\EnableFeature;
-use Pheature\Crud\Toggle\Handler\RemoveFeature;
-use Pheature\Crud\Toggle\Handler\RemoveStrategy;
 use Pheature\Model\Toggle\EnableByMatchingIdentityId;
 use Pheature\Model\Toggle\EnableByMatchingSegment;
 use Pheature\Model\Toggle\IdentitySegment;
 use Pheature\Model\Toggle\SegmentFactory;
 use Pheature\Model\Toggle\StrategyFactory;
 use Pheature\Model\Toggle\StrictMatchingSegment;
-use Pheature\Sdk\CommandRunner;
 
 use function array_merge;
 use function array_reduce;
@@ -85,33 +56,7 @@ final class ToggleConfigProvider
                     RouterDelegator::class => RouterDelegator::class,
                 ],
                 'aliases' => array_merge($strategyTypeAliases, $segmentTypeAliases),
-                'factories' => [
-                    // Config
-                    ToggleConfig::class => ToggleConfigFactory::class,
-                    // SDK
-                    CommandRunner::class => CommandRunnerFactory::class,
-                    // CRUD
-                    CreateFeature::class => CreateFeatureFactory::class,
-                    SetStrategy::class => SetStrategyFactory::class,
-                    RemoveStrategy::class => RemoveStrategyFactory::class,
-                    EnableFeature::class => EnableFeatureFactory::class,
-                    DisableFeature::class => DisableFeatureFactory::class,
-                    RemoveFeature::class => RemoveFeatureFactory::class,
-                    // CRUD API
-                    GetFeatures::class => GetFeaturesFactory::class,
-                    GetFeature::class => GetFeatureFactory::class,
-                    PostFeature::class => PostFeatureFactory::class,
-                    PatchFeature::class => PatchFeatureFactory::class,
-                    DeleteFeature::class => DeleteFeatureFactory::class,
-                    // Read model
-                    FeatureFinder::class => FeatureFinderFactory::class,
-                    // Write model
-                    FeatureRepository::class => FeatureRepositoryFactory::class,
-
-                    StrategyFactory::class => \Pheature\Crud\Psr11\Toggle\StrategyFactory::class,
-                    SegmentFactory::class => \Pheature\Crud\Psr11\Toggle\SegmentFactory::class,
-                    ChainToggleStrategyFactory::class => \Pheature\Crud\Psr11\Toggle\ChainToggleStrategyFactory::class,
-                ],
+                'factories' => [],
                 'delegators' => [
                     Application::class => [
                         RouterDelegator::class,
diff --git a/packages/php-sdk/composer.json b/packages/php-sdk/composer.json
index 7d30d67..9c193b5 100644
--- a/packages/php-sdk/composer.json
+++ b/packages/php-sdk/composer.json
@@ -7,6 +7,12 @@
     "authors": [
         {
             "name": "kpicaza"
+        },
+        {
+            "name": "pcs289"
+        },
+        {
+            "name": "xserrat"
         }
     ],
     "require": {
@@ -31,7 +37,7 @@
     },
     "autoload-dev": {
         "psr-4": {
-            "Test\\Pheature\\Sdk\\": "test"
+            "Pheature\\Test\\Sdk\\": "test"
         }
     },
     "scripts": {
@@ -49,6 +55,11 @@
         "psalm": "psalm",
         "test": "phpunit --colors=always"
     },
+    "extra": {
+        "laminas": {
+            "config-provider": "Pheature\\Sdk\\Container\\ConfigProvider"
+        }
+    },
     "config": {
         "sort-packages": true
     }
diff --git a/packages/php-sdk/src/Container/ConfigProvider.php b/packages/php-sdk/src/Container/ConfigProvider.php
new file mode 100644
index 0000000..f56aa82
--- /dev/null
+++ b/packages/php-sdk/src/Container/ConfigProvider.php
@@ -0,0 +1,25 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Pheature\Sdk\Container;
+
+use Pheature\Crud\Psr11\Toggle\CommandRunnerFactory;
+use Pheature\Sdk\CommandRunner;
+
+final class ConfigProvider
+{
+    /**
+     * @return array<string, array<string, array<string, string>>>
+     */
+    public function __invoke(): array
+    {
+        return [
+            'dependencies' => [
+                'factories' => [
+                    CommandRunner::class => CommandRunnerFactory::class,
+                ],
+            ],
+        ];
+    }
+}
diff --git a/packages/symfony-toggle/composer.json b/packages/symfony-toggle/composer.json
index 919078c..ef45793 100644
--- a/packages/symfony-toggle/composer.json
+++ b/packages/symfony-toggle/composer.json
@@ -7,6 +7,12 @@
     "authors": [
         {
             "name": "kpicaza"
+        },
+        {
+            "name": "pcs289"
+        },
+        {
+            "name": "xserrat"
         }
     ],
     "require": {
diff --git a/packages/toggle-core/composer.json b/packages/toggle-core/composer.json
index b9847a5..1354f85 100644
--- a/packages/toggle-core/composer.json
+++ b/packages/toggle-core/composer.json
@@ -7,6 +7,12 @@
     "authors": [
         {
             "name": "kpicaza"
+        },
+        {
+            "name": "pcs289"
+        },
+        {
+            "name": "xserrat"
         }
     ],
     "require": {
@@ -47,6 +53,11 @@
         "psalm": "psalm",
         "infection": "XDEBUG_MODE=coverage roave-infection-static-analysis-plugin"
     },
+    "extra": {
+        "laminas": {
+            "config-provider": "Pheature\\Core\\Toggle\\Container\\ConfigProvider"
+        }
+    },
     "config": {
         "sort-packages": true
     }
diff --git a/packages/toggle-core/src/Container/ConfigProvider.php b/packages/toggle-core/src/Container/ConfigProvider.php
new file mode 100644
index 0000000..f941a2d
--- /dev/null
+++ b/packages/toggle-core/src/Container/ConfigProvider.php
@@ -0,0 +1,33 @@
+<?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-core/src/Read/ChainToggleStrategyFactory.php b/packages/toggle-core/src/Read/ChainToggleStrategyFactory.php
index 3715276..07d4ef4 100644
--- a/packages/toggle-core/src/Read/ChainToggleStrategyFactory.php
+++ b/packages/toggle-core/src/Read/ChainToggleStrategyFactory.php
@@ -63,10 +63,12 @@ final class ChainToggleStrategyFactory implements ToggleStrategyFactory
 
     public function types(): array
     {
-        return array_merge(
-            ...array_map(
-                static fn(ToggleStrategyFactory $strategyFactory) => $strategyFactory->types(),
-                $this->toggleStrategyFactories
+        return array_unique(
+            array_merge(
+                ...array_map(
+                    static fn(ToggleStrategyFactory $strategyFactory) => $strategyFactory->types(),
+                    $this->toggleStrategyFactories
+                )
             )
         );
     }
diff --git a/packages/toggle-crud-psr11-factories/composer.json b/packages/toggle-crud-psr11-factories/composer.json
index d8ac8a7..c0b4199 100644
--- a/packages/toggle-crud-psr11-factories/composer.json
+++ b/packages/toggle-crud-psr11-factories/composer.json
@@ -7,6 +7,12 @@
     "authors": [
         {
             "name": "kpicaza"
+        },
+        {
+            "name": "pcs289"
+        },
+        {
+            "name": "xserrat"
         }
     ],
     "require": {
@@ -20,6 +26,7 @@
         "infection/infection": "^0.23.0",
         "pheature/dbal-toggle": "^0.1.1",
         "pheature/inmemory-toggle": "^0.1.1",
+        "pheature/php-sdk": "^0.1.1",
         "phpro/grumphp": "^1.0",
         "phpstan/phpstan": "^0.12",
         "phpunit/phpunit": "^8.0 || ^9.0",
@@ -56,6 +63,11 @@
     "config": {
         "sort-packages": true
     },
+    "extra": {
+        "laminas": {
+            "config-provider": "Pheature\\Crud\\Psr11\\Toggle\\Container\\ConfigProvider"
+        }
+    },
     "suggest": {
         "pheature/dbal-toggle": "Dbal toggle implementation",
         "pheature/inmemory-toggle": "In memory toggle implementation"
diff --git a/packages/mezzio-toggle/src/CommandRunnerFactory.php b/packages/toggle-crud-psr11-factories/src/CommandRunnerFactory.php
similarity index 93%
rename from packages/mezzio-toggle/src/CommandRunnerFactory.php
rename to packages/toggle-crud-psr11-factories/src/CommandRunnerFactory.php
index 0133e49..b842864 100644
--- a/packages/mezzio-toggle/src/CommandRunnerFactory.php
+++ b/packages/toggle-crud-psr11-factories/src/CommandRunnerFactory.php
@@ -2,7 +2,7 @@
 
 declare(strict_types=1);
 
-namespace Pheature\Community\Mezzio;
+namespace Pheature\Crud\Psr11\Toggle;
 
 use Pheature\Core\Toggle\Read\FeatureFinder;
 use Pheature\Core\Toggle\Read\Toggle;
diff --git a/packages/toggle-crud-psr11-factories/src/Container/ConfigProvider.php b/packages/toggle-crud-psr11-factories/src/Container/ConfigProvider.php
new file mode 100644
index 0000000..8ef37c0
--- /dev/null
+++ b/packages/toggle-crud-psr11-factories/src/Container/ConfigProvider.php
@@ -0,0 +1,25 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Pheature\Crud\Psr11\Toggle\Container;
+
+use Pheature\Community\Mezzio\ToggleConfigFactory;
+use Pheature\Crud\Psr11\Toggle\ToggleConfig;
+
+final class ConfigProvider
+{
+    /**
+     * @return array<string, array<string, array<string, string>>>
+     */
+    public function __invoke(): array
+    {
+        return [
+            'dependencies' => [
+                'factories' => [
+                    ToggleConfig::class => ToggleConfigFactory::class,
+                ],
+            ],
+        ];
+    }
+}
diff --git a/packages/toggle-crud-psr11-factories/src/ToggleFactory.php b/packages/toggle-crud-psr11-factories/src/ToggleFactory.php
new file mode 100644
index 0000000..ae46d1b
--- /dev/null
+++ b/packages/toggle-crud-psr11-factories/src/ToggleFactory.php
@@ -0,0 +1,25 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Pheature\Crud\Psr11\Toggle;
+
+use Pheature\Core\Toggle\Read\FeatureFinder;
+use Pheature\Core\Toggle\Read\Toggle;
+use Psr\Container\ContainerInterface;
+
+final class ToggleFactory
+{
+    public function __invoke(ContainerInterface $container): Toggle
+    {
+        /** @var FeatureFinder $featureFinder */
+        $featureFinder = $container->get(FeatureFinder::class);
+
+        return self::create($featureFinder);
+    }
+
+    public static function create(FeatureFinder $featureFinder): Toggle
+    {
+        return new Toggle($featureFinder);
+    }
+}
diff --git a/packages/toggle-crud-psr7-api/composer.json b/packages/toggle-crud-psr7-api/composer.json
index 0f55eb0..8969529 100644
--- a/packages/toggle-crud-psr7-api/composer.json
+++ b/packages/toggle-crud-psr7-api/composer.json
@@ -7,6 +7,12 @@
     "authors": [
         {
             "name": "kpicaza"
+        },
+        {
+            "name": "pcs289"
+        },
+        {
+            "name": "xserrat"
         }
     ],
     "require": {
@@ -54,6 +60,11 @@
         "psalm": "psalm",
         "infection": "XDEBUG_MODE=coverage roave-infection-static-analysis-plugin"
     },
+    "extra": {
+        "laminas": {
+            "config-provider": "Pheature\\Crud\\Psr7\\Toggle\\Container\\ConfigProvider"
+        }
+    },
     "config": {
         "sort-packages": true
     }
diff --git a/packages/toggle-crud-psr7-api/src/Container/ConfigProvider.php b/packages/toggle-crud-psr7-api/src/Container/ConfigProvider.php
new file mode 100644
index 0000000..6c5b957
--- /dev/null
+++ b/packages/toggle-crud-psr7-api/src/Container/ConfigProvider.php
@@ -0,0 +1,37 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Pheature\Crud\Psr7\Toggle\Container;
+
+use Pheature\Crud\Psr11\Toggle\DeleteFeatureFactory;
+use Pheature\Crud\Psr11\Toggle\GetFeatureFactory;
+use Pheature\Crud\Psr11\Toggle\GetFeaturesFactory;
+use Pheature\Crud\Psr11\Toggle\PatchFeatureFactory;
+use Pheature\Crud\Psr11\Toggle\PostFeatureFactory;
+use Pheature\Crud\Psr7\Toggle\DeleteFeature;
+use Pheature\Crud\Psr7\Toggle\GetFeature;
+use Pheature\Crud\Psr7\Toggle\GetFeatures;
+use Pheature\Crud\Psr7\Toggle\PatchFeature;
+use Pheature\Crud\Psr7\Toggle\PostFeature;
+
+final class ConfigProvider
+{
+    /**
+     * @return array<string, array<string, array<string, string>>>
+     */
+    public function __invoke(): array
+    {
+        return [
+            'dependencies' => [
+                'factories' => [
+                    GetFeatures::class => GetFeaturesFactory::class,
+                    GetFeature::class => GetFeatureFactory::class,
+                    PostFeature::class => PostFeatureFactory::class,
+                    PatchFeature::class => PatchFeatureFactory::class,
+                    DeleteFeature::class => DeleteFeatureFactory::class,
+                ],
+            ],
+        ];
+    }
+}
diff --git a/packages/toggle-crud/composer.json b/packages/toggle-crud/composer.json
index 47b0a0d..fb86066 100644
--- a/packages/toggle-crud/composer.json
+++ b/packages/toggle-crud/composer.json
@@ -7,6 +7,12 @@
     "authors": [
         {
             "name": "kpicaza"
+        },
+        {
+            "name": "pcs289"
+        },
+        {
+            "name": "xserrat"
         }
     ],
     "require": {
@@ -49,6 +55,11 @@
         "psalm": "psalm",
         "infection": "XDEBUG_MODE=coverage roave-infection-static-analysis-plugin"
     },
+    "extra": {
+        "laminas": {
+            "config-provider": "Pheature\\Crud\\Toggle\\Container\\ConfigProvider"
+        }
+    },
     "config": {
         "sort-packages": true
     }
diff --git a/packages/toggle-crud/src/Container/ConfigProvider.php b/packages/toggle-crud/src/Container/ConfigProvider.php
new file mode 100644
index 0000000..e91386f
--- /dev/null
+++ b/packages/toggle-crud/src/Container/ConfigProvider.php
@@ -0,0 +1,40 @@
+<?php
+
+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\CreateFeature;
+use Pheature\Crud\Toggle\Handler\DisableFeature;
+use Pheature\Crud\Toggle\Handler\EnableFeature;
+use Pheature\Crud\Toggle\Handler\RemoveFeature;
+use Pheature\Crud\Toggle\Handler\RemoveStrategy;
+use Pheature\Crud\Toggle\Handler\SetStrategy;
+
+final class ConfigProvider
+{
+    /**
+     * @return array<string, array<string, array<string, string>>>
+     */
+    public function __invoke(): array
+    {
+        return [
+            'dependencies' => [
+                'factories' => [
+                    CreateFeature::class => CreateFeatureFactory::class,
+                    SetStrategy::class => SetStrategyFactory::class,
+                    RemoveStrategy::class => RemoveStrategyFactory::class,
+                    EnableFeature::class => EnableFeatureFactory::class,
+                    DisableFeature::class => DisableFeatureFactory::class,
+                    RemoveFeature::class => RemoveFeatureFactory::class,
+                ],
+            ],
+        ];
+    }
+}
diff --git a/packages/toggle-model/composer.json b/packages/toggle-model/composer.json
index 1aa0c67..26a0336 100644
--- a/packages/toggle-model/composer.json
+++ b/packages/toggle-model/composer.json
@@ -7,6 +7,12 @@
     "authors": [
         {
             "name": "kpicaza"
+        },
+        {
+            "name": "pcs289"
+        },
+        {
+            "name": "xserrat"
         }
     ],
     "require": {
diff --git a/packages/toggle-model/src/Container/ConfigProvider.php b/packages/toggle-model/src/Container/ConfigProvider.php
new file mode 100644
index 0000000..5f24580
--- /dev/null
+++ b/packages/toggle-model/src/Container/ConfigProvider.php
@@ -0,0 +1,26 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Pheature\Model\Toggle\Container;
+
+use Pheature\Model\Toggle\SegmentFactory;
+use Pheature\Model\Toggle\StrategyFactory;
+
+final class ConfigProvider
+{
+    /**
+     * @return array<string, array<string, array<string, string>>>
+     */
+    public function __invoke(): array
+    {
+        return [
+            'dependencies' => [
+                'factories' => [
+                    StrategyFactory::class => \Pheature\Crud\Psr11\Toggle\StrategyFactory::class,
+                    SegmentFactory::class => \Pheature\Crud\Psr11\Toggle\SegmentFactory::class,
+                ],
+            ],
+        ];
+    }
+}


Test patch:
diff --git a/packages/dbal-toggle/test/Container/ConfigProviderTest.php b/packages/dbal-toggle/test/Container/ConfigProviderTest.php
new file mode 100644
index 0000000..1a504b3
--- /dev/null
+++ b/packages/dbal-toggle/test/Container/ConfigProviderTest.php
@@ -0,0 +1,33 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Pheature\Test\Dbal\Toggle\Container;
+
+use Pheature\Dbal\Toggle\Cli\InitSchema;
+use Pheature\Dbal\Toggle\Container\ConfigProvider;
+use Pheature\Dbal\Toggle\Container\InitSchemaFactory;
+use PHPUnit\Framework\TestCase;
+
+final class ConfigProviderTest extends TestCase
+{
+    private const EXPECTED_CONFIG = [
+        'dependencies' => [
+            'factories' => [
+                InitSchema::class => InitSchemaFactory::class,
+            ],
+        ],
+        'laminas-cli' => [
+            'commands' => [
+                'pheature:dbal:init-toggle' => InitSchema::class,
+            ],
+        ],
+    ];
+
+    public function testItShouldCreateTheCorrectConfiguration(): void
+    {
+        $actual = (new ConfigProvider())->__invoke();
+
+        self::assertSame(self::EXPECTED_CONFIG, $actual);
+    }
+}
diff --git a/packages/mezzio-toggle/test/Fixtures/PheatureFlagsConfig.php b/packages/mezzio-toggle/test/Fixtures/PheatureFlagsConfig.php
new file mode 100644
index 0000000..1aad19e
--- /dev/null
+++ b/packages/mezzio-toggle/test/Fixtures/PheatureFlagsConfig.php
@@ -0,0 +1,73 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Pheature\Test\Community\Mezzio\Fixtures;
+
+use Pheature\Model\Toggle\EnableByMatchingIdentityId;
+use Pheature\Model\Toggle\EnableByMatchingSegment;
+use Pheature\Model\Toggle\IdentitySegment;
+use Pheature\Model\Toggle\SegmentFactory;
+use Pheature\Model\Toggle\StrategyFactory;
+use Pheature\Model\Toggle\StrictMatchingSegment;
+
+final class PheatureFlagsConfig
+{
+    private array $config;
+
+    public function __construct(array $config)
+    {
+        $this->config = $config;
+    }
+
+    public static function createDefault(): self
+    {
+        $defaultConfig = [
+            'driver' => 'inmemory',
+            'api_prefix' => '',
+            'api_enabled' => false,
+            'segment_types' => [
+                [
+                    'type' => IdentitySegment::NAME,
+                    'factory_id' => SegmentFactory::class
+                ],
+                [
+                    'type' => StrictMatchingSegment::NAME,
+                    'factory_id' => SegmentFactory::class
+                ]
+            ],
+            'strategy_types' => [
+                [
+                    'type' => EnableByMatchingSegment::NAME,
+                    'factory_id' => StrategyFactory::class
+                ],
+                [
+                    'type' => EnableByMatchingIdentityId::NAME,
+                    'factory_id' => StrategyFactory::class
+                ]
+            ],
+            'toggles' => [],
+        ];
+
+        return new self($defaultConfig);
+    }
+
+    public function withApiEnabled(bool $enabled): self
+    {
+        $this->config['api_enabled'] = $enabled;
+
+        return $this;
+    }
+
+    public function withApiPrefix(string $prefix): self
+    {
+        $this->config['api_prefix'] = $prefix;
+
+        return $this;
+    }
+
+    public function build(): array
+    {
+        return $this->config;
+    }
+}
diff --git a/packages/mezzio-toggle/test/Fixtures/ToggleConfiguration.php b/packages/mezzio-toggle/test/Fixtures/ToggleConfiguration.php
index 18b7210..27b8317 100644
--- a/packages/mezzio-toggle/test/Fixtures/ToggleConfiguration.php
+++ b/packages/mezzio-toggle/test/Fixtures/ToggleConfiguration.php
@@ -5,44 +5,14 @@ declare(strict_types=1);
 namespace Pheature\Test\Community\Mezzio\Fixtures;
 
 use Mezzio\Application;
-use Pheature\Community\Mezzio\CommandRunnerFactory;
 use Pheature\Community\Mezzio\RouterDelegator;
-use Pheature\Community\Mezzio\ToggleConfigFactory;
-use Pheature\Core\Toggle\Read\ChainToggleStrategyFactory;
-use Pheature\Core\Toggle\Read\FeatureFinder;
-use Pheature\Core\Toggle\Write\FeatureRepository;
-use Pheature\Crud\Psr11\Toggle\CreateFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\DeleteFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\DisableFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\EnableFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\FeatureFinderFactory;
-use Pheature\Crud\Psr11\Toggle\FeatureRepositoryFactory;
-use Pheature\Crud\Psr11\Toggle\GetFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\GetFeaturesFactory;
-use Pheature\Crud\Psr11\Toggle\PatchFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\PostFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\RemoveFeatureFactory;
-use Pheature\Crud\Psr11\Toggle\RemoveStrategyFactory;
-use Pheature\Crud\Psr11\Toggle\SetStrategyFactory;
 use Pheature\Crud\Psr11\Toggle\ToggleConfig;
-use Pheature\Crud\Psr7\Toggle\DeleteFeature;
-use Pheature\Crud\Psr7\Toggle\GetFeature;
-use Pheature\Crud\Psr7\Toggle\GetFeatures;
-use Pheature\Crud\Psr7\Toggle\PatchFeature;
-use Pheature\Crud\Psr7\Toggle\PostFeature;
-use Pheature\Crud\Toggle\Handler\CreateFeature;
-use Pheature\Crud\Toggle\Handler\DisableFeature;
-use Pheature\Crud\Toggle\Handler\EnableFeature;
-use Pheature\Crud\Toggle\Handler\RemoveFeature;
-use Pheature\Crud\Toggle\Handler\RemoveStrategy;
-use Pheature\Crud\Toggle\Handler\SetStrategy;
 use Pheature\Model\Toggle\EnableByMatchingIdentityId;
 use Pheature\Model\Toggle\EnableByMatchingSegment;
 use Pheature\Model\Toggle\IdentitySegment;
 use Pheature\Model\Toggle\SegmentFactory;
 use Pheature\Model\Toggle\StrategyFactory;
 use Pheature\Model\Toggle\StrictMatchingSegment;
-use Pheature\Sdk\CommandRunner;
 
 final class ToggleConfiguration
 {
@@ -59,33 +29,7 @@ final class ToggleConfiguration
                     'identity_segment' => SegmentFactory::class,
                     'strict_matching_segment' => SegmentFactory::class,
                 ],
-                'factories' => [
-                    // Config
-                    ToggleConfig::class => ToggleConfigFactory::class,
-                    // SDK
-                    CommandRunner::class => CommandRunnerFactory::class,
-                    // CRUD
-                    CreateFeature::class => CreateFeatureFactory::class,
-                    SetStrategy::class => SetStrategyFactory::class,
-                    RemoveStrategy::class => RemoveStrategyFactory::class,
-                    EnableFeature::class => EnableFeatureFactory::class,
-                    DisableFeature::class => DisableFeatureFactory::class,
-                    RemoveFeature::class => RemoveFeatureFactory::class,
-                    // CRUD API
-                    GetFeatures::class => GetFeaturesFactory::class,
-                    GetFeature::class => GetFeatureFactory::class,
-                    PostFeature::class => PostFeatureFactory::class,
-                    PatchFeature::class => PatchFeatureFactory::class,
-                    DeleteFeature::class => DeleteFeatureFactory::class,
-                    // Read model
-                    FeatureFinder::class => FeatureFinderFactory::class,
-                    // Write model
-                    FeatureRepository::class => FeatureRepositoryFactory::class,
-
-                    StrategyFactory::class => \Pheature\Crud\Psr11\Toggle\StrategyFactory::class,
-                    SegmentFactory::class => \Pheature\Crud\Psr11\Toggle\SegmentFactory::class,
-                    ChainToggleStrategyFactory::class => \Pheature\Crud\Psr11\Toggle\ChainToggleStrategyFactory::class,
-                ],
+                'factories' => [],
                 'delegators' => [
                     Application::class => [
                         RouterDelegator::class,
diff --git a/packages/mezzio-toggle/test/RouterDelegatorTest.php b/packages/mezzio-toggle/test/RouterDelegatorTest.php
index 6cb5baa..3a6011f 100644
--- a/packages/mezzio-toggle/test/RouterDelegatorTest.php
+++ b/packages/mezzio-toggle/test/RouterDelegatorTest.php
@@ -14,9 +14,8 @@ use Pheature\Crud\Psr7\Toggle\GetFeature;
 use Pheature\Crud\Psr7\Toggle\GetFeatures;
 use Pheature\Crud\Psr7\Toggle\PatchFeature;
 use Pheature\Crud\Psr7\Toggle\PostFeature;
+use Pheature\Test\Community\Mezzio\Fixtures\PheatureFlagsConfig;
 use Pheature\Test\Community\Mezzio\Fixtures\TestContainerFactory;
-use Pheature\Test\Crud\Psr11\Toggle\Fixtures\PheatureFlagsConfig;
-use Pheature\Test\Crud\Psr11\Toggle\Fixtures\TestToggleConfigFactory;
 use PHPUnit\Framework\TestCase;
 
 final class RouterDelegatorTest extends TestCase
@@ -34,7 +33,7 @@ final class RouterDelegatorTest extends TestCase
             ->withApiEnabled(true)
             ->withApiPrefix($apiPrefix)
             ->build();
-        $toggleConfig = TestToggleConfigFactory::create($config);
+        $toggleConfig = new ToggleConfig($config);
         $container = TestContainerFactory::create([ToggleConfig::class => $toggleConfig]);
 
         $application = $this->createMock(Application::class);
@@ -60,7 +59,7 @@ final class RouterDelegatorTest extends TestCase
         $config = PheatureFlagsConfig::createDefault()
             ->withApiEnabled(false)
             ->build();
-        $toggleConfig = TestToggleConfigFactory::create($config);
+        $toggleConfig = new ToggleConfig($config);
         $container = TestContainerFactory::create([ToggleConfig::class => $toggleConfig]);
 
         $application = $this->createMock(Application::class);
diff --git a/packages/php-sdk/test/Container/ConfigProviderTest.php b/packages/php-sdk/test/Container/ConfigProviderTest.php
new file mode 100644
index 0000000..254d7eb
--- /dev/null
+++ b/packages/php-sdk/test/Container/ConfigProviderTest.php
@@ -0,0 +1,28 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Pheature\Test\Sdk\Container;
+
+use Pheature\Crud\Psr11\Toggle\CommandRunnerFactory;
+use Pheature\Sdk\CommandRunner;
+use Pheature\Sdk\Container\ConfigProvider;
+use PHPUnit\Framework\TestCase;
+
+final class ConfigProviderTest extends TestCase
+{
+    private const EXPECTED_CONFIG = [
+        'dependencies' => [
+            'factories' => [
+                CommandRunner::class => CommandRunnerFactory::class,
+            ],
+        ],
+    ];
+
+    public function testItShouldCreateTheCorrectConfiguration(): void
+    {
+        $actual = (new ConfigProvider())->__invoke();
+
+        self::assertSame(self::EXPECTED_CONFIG, $actual);
+    }
+}
diff --git a/packages/toggle-core/test/Container/ConfigProviderTest.php b/packages/toggle-core/test/Container/ConfigProviderTest.php
new file mode 100644
index 0000000..d613528
--- /dev/null
+++ b/packages/toggle-core/test/Container/ConfigProviderTest.php
@@ -0,0 +1,36 @@
+<?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/mezzio-toggle/test/CommandRunnerFactoryTest.php b/packages/toggle-crud-psr11-factories/test/CommandRunnerFactoryTest.php
similarity index 54%
rename from packages/mezzio-toggle/test/CommandRunnerFactoryTest.php
rename to packages/toggle-crud-psr11-factories/test/CommandRunnerFactoryTest.php
index cd38730..da6b599 100644
--- a/packages/mezzio-toggle/test/CommandRunnerFactoryTest.php
+++ b/packages/toggle-crud-psr11-factories/test/CommandRunnerFactoryTest.php
@@ -2,14 +2,16 @@
 
 declare(strict_types=1);
 
-namespace Pheature\Test\Community\Mezzio;
+namespace Pheature\Test\Crud\Psr11\Toggle;
 
-use Pheature\Community\Mezzio\CommandRunnerFactory;
+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 PHPUnit\Framework\MockObject\MockObject;
 use PHPUnit\Framework\TestCase;
+use Psr\Container\ContainerInterface;
 use Psr\Container\NotFoundExceptionInterface;
 
 final class CommandRunnerFactoryTest extends TestCase
@@ -18,7 +20,16 @@ final class CommandRunnerFactoryTest extends TestCase
     {
         $this->expectException(NotFoundExceptionInterface::class);
 
-        $emptyContainer = TestContainerFactory::create();
+        $notFoundException = new class() extends Exception implements NotFoundExceptionInterface {
+        };
+
+        /** @var ContainerInterface|MockObject $emptyContainer */
+        $emptyContainer = $this->createMock(ContainerInterface::class);
+        $emptyContainer
+            ->expects($this->once())
+            ->method('get')
+            ->with(FeatureFinder::class)
+            ->willThrowException($notFoundException);
 
         $commandRunnerFactory = new CommandRunnerFactory();
         $commandRunnerFactory->__invoke($emptyContainer);
@@ -28,7 +39,14 @@ final class CommandRunnerFactoryTest extends TestCase
     {
         /** @var FeatureFinder|MockObject $featureFinder */
         $featureFinder = $this->createMock(FeatureFinder::class);
-        $container = TestContainerFactory::create([FeatureFinder::class => $featureFinder]);
+
+        /** @var ContainerInterface|MockObject $container */
+        $container = $this->createMock(ContainerInterface::class);
+        $container
+            ->expects($this->once())
+            ->method('get')
+            ->with(FeatureFinder::class)
+            ->willReturn($featureFinder);
 
         $commandRunnerFactory = new CommandRunnerFactory();
         $actual = $commandRunnerFactory->__invoke($container);
diff --git a/packages/toggle-crud-psr11-factories/test/Container/ConfigProviderTest.php b/packages/toggle-crud-psr11-factories/test/Container/ConfigProviderTest.php
new file mode 100644
index 0000000..2da5789
--- /dev/null
+++ b/packages/toggle-crud-psr11-factories/test/Container/ConfigProviderTest.php
@@ -0,0 +1,28 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Pheature\Test\Crud\Psr11\Toggle\Container;
+
+use Pheature\Community\Mezzio\ToggleConfigFactory;
+use Pheature\Crud\Psr11\Toggle\Container\ConfigProvider;
+use Pheature\Crud\Psr11\Toggle\ToggleConfig;
+use PHPUnit\Framework\TestCase;
+
+final class ConfigProviderTest extends TestCase
+{
+    private const EXPECTED_CONFIG = [
+        'dependencies' => [
+            'factories' => [
+                ToggleConfig::class => ToggleConfigFactory::class,
+            ],
+        ],
+    ];
+
+    public function testItShouldCreateTheCorrectConfiguration(): void
+    {
+        $actual = (new ConfigProvider())->__invoke();
+
+        self::assertSame(self::EXPECTED_CONFIG, $actual);
+    }
+}
diff --git a/packages/toggle-crud-psr11-factories/test/Fixtures/TestToggleConfigFactory.php b/packages/toggle-crud-psr11-factories/test/Fixtures/TestToggleConfigFactory.php
deleted file mode 100644
index 38c70d4..0000000
--- a/packages/toggle-crud-psr11-factories/test/Fixtures/TestToggleConfigFactory.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Pheature\Test\Crud\Psr11\Toggle\Fixtures;
-
-use Pheature\Crud\Psr11\Toggle\ToggleConfig;
-
-final class TestToggleConfigFactory
-{
-    public static function create($config = []): ToggleConfig
-    {
-        return new ToggleConfig($config);
-    }
-}
diff --git a/packages/toggle-crud-psr11-factories/test/ToggleFactoryTest.php b/packages/toggle-crud-psr11-factories/test/ToggleFactoryTest.php
new file mode 100644
index 0000000..db23e9a
--- /dev/null
+++ b/packages/toggle-crud-psr11-factories/test/ToggleFactoryTest.php
@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Pheature\Test\Crud\Psr11\Toggle;
+
+use Pheature\Core\Toggle\Read\FeatureFinder;
+use Pheature\Crud\Psr11\Toggle\ToggleFactory;
+use PHPUnit\Framework\TestCase;
+use Psr\Container\ContainerInterface;
+
+final class ToggleFactoryTest extends TestCase
+{
+    public function testItShouldCreateInstanceOfToggleFactory(): void
+    {
+        $featureFinder = $this->createMock(FeatureFinder::class);
+        $container = $this->createMock(ContainerInterface::class);
+        $container->expects(static::once())
+            ->method('get')
+            ->with(FeatureFinder::class)
+            ->willReturn($featureFinder);
+
+        $toggleFactory = new ToggleFactory();
+
+        $toggleFactory->__invoke($container);
+    }
+}
diff --git a/packages/toggle-crud-psr7-api/test/Container/ConfigProviderTest.php b/packages/toggle-crud-psr7-api/test/Container/ConfigProviderTest.php
new file mode 100644
index 0000000..dc2b381
--- /dev/null
+++ b/packages/toggle-crud-psr7-api/test/Container/ConfigProviderTest.php
@@ -0,0 +1,40 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Pheature\Test\Crud\Psr7\Toggle\Container;
+
+use Pheature\Crud\Psr11\Toggle\DeleteFeatureFactory;
+use Pheature\Crud\Psr11\Toggle\GetFeatureFactory;
+use Pheature\Crud\Psr11\Toggle\GetFeaturesFactory;
+use Pheature\Crud\Psr11\Toggle\PatchFeatureFactory;
+use Pheature\Crud\Psr11\Toggle\PostFeatureFactory;
+use Pheature\Crud\Psr7\Toggle\Container\ConfigProvider;
+use Pheature\Crud\Psr7\Toggle\DeleteFeature;
+use Pheature\Crud\Psr7\Toggle\GetFeature;
+use Pheature\Crud\Psr7\Toggle\GetFeatures;
+use Pheature\Crud\Psr7\Toggle\PatchFeature;
+use Pheature\Crud\Psr7\Toggle\PostFeature;
+use PHPUnit\Framework\TestCase;
+
+final class ConfigProviderTest extends TestCase
+{
+    private const EXPECTED_CONFIG = [
+        'dependencies' => [
+            'factories' => [
+                GetFeatures::class => GetFeaturesFactory::class,
+                GetFeature::class => GetFeatureFactory::class,
+                PostFeature::class => PostFeatureFactory::class,
+                PatchFeature::class => PatchFeatureFactory::class,
+                DeleteFeature::class => DeleteFeatureFactory::class,
+            ],
+        ],
+    ];
+
+    public function testItShouldCreateTheCorrectConfiguration(): void
+    {
+        $actual = (new ConfigProvider())->__invoke();
+
+        self::assertSame(self::EXPECTED_CONFIG, $actual);
+    }
+}
diff --git a/packages/toggle-crud/test/Container/ConfigProviderTest.php b/packages/toggle-crud/test/Container/ConfigProviderTest.php
new file mode 100644
index 0000000..fbec536
--- /dev/null
+++ b/packages/toggle-crud/test/Container/ConfigProviderTest.php
@@ -0,0 +1,43 @@
+<?php
+
+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\Container\ConfigProvider;
+use Pheature\Crud\Toggle\Handler\CreateFeature;
+use Pheature\Crud\Toggle\Handler\DisableFeature;
+use Pheature\Crud\Toggle\Handler\EnableFeature;
+use Pheature\Crud\Toggle\Handler\RemoveFeature;
+use Pheature\Crud\Toggle\Handler\RemoveStrategy;
+use Pheature\Crud\Toggle\Handler\SetStrategy;
+use PHPUnit\Framework\TestCase;
+
+final class ConfigProviderTest extends TestCase
+{
+    private const EXPECTED_CONFIG = [
+        'dependencies' => [
+            'factories' => [
+                CreateFeature::class => CreateFeatureFactory::class,
+                SetStrategy::class => SetStrategyFactory::class,
+                RemoveStrategy::class => RemoveStrategyFactory::class,
+                EnableFeature::class => EnableFeatureFactory::class,
+                DisableFeature::class => DisableFeatureFactory::class,
+                RemoveFeature::class => RemoveFeatureFactory::class,
+            ],
+        ],
+    ];
+
+    public function testItShouldCreateTheCorrectConfiguration(): void
+    {
+        $actual = (new ConfigProvider())->__invoke();
+
+        self::assertSame(self::EXPECTED_CONFIG, $actual);
+    }
+}
diff --git a/packages/toggle-model/test/Container/ConfigProviderTest.php b/packages/toggle-model/test/Container/ConfigProviderTest.php
new file mode 100644
index 0000000..e9ebd74
--- /dev/null
+++ b/packages/toggle-model/test/Container/ConfigProviderTest.php
@@ -0,0 +1,29 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Pheature\Test\Model\Toggle\Container;
+
+use Pheature\Model\Toggle\Container\ConfigProvider;
+use Pheature\Model\Toggle\SegmentFactory;
+use Pheature\Model\Toggle\StrategyFactory;
+use PHPUnit\Framework\TestCase;
+
+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,
+            ],
+        ],
+    ];
+
+    public function testItShouldCreateTheCorrectConfiguration(): void
+    {
+        $actual = (new ConfigProvider())->__invoke();
+
+        self::assertSame(self::EXPECTED_CONFIG, $actual);
+    }
+}