From 7b4342ac97b55b5419f3c75cde2d0b2997a2594c Mon Sep 17 00:00:00 2001
From: Michael Hoffmann <michi@hey.com>
Date: Tue, 30 Jul 2024 23:57:18 +0200
Subject: [PATCH 1/2] Load features config inside
 `FeatureFlagsPlugin::bootstrap`

---
 .gitignore                 |  1 +
 README.md                  | 20 ++++++--------------
 src/FeatureFlagsPlugin.php | 14 ++++++++++----
 3 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/.gitignore b/.gitignore
index d959026..0d492a6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,6 +26,7 @@ Thumbs.db
 #######################
 # PHPUnit
 .phpunit.cache
+.phpunit.result.cache
 tests.sqlite
 # vim
 *~
diff --git a/README.md b/README.md
index a3e5e02..909d836 100644
--- a/README.md
+++ b/README.md
@@ -19,6 +19,12 @@ The recommended way to install composer packages is:
 composer require markstory/cakephp-feature-flags
 ```
 
+Next, load the plugin by running the following command:
+
+```
+bin/cake plugin load FeatureFlags
+```
+
 ## Usage
 
 First you need to decide if you want simple boolean feature flags, or more complex
@@ -39,13 +45,6 @@ return [
 ];
 ```
 
-Next, in `config/bootstrap.php` add the following:
-
-```php
-// Load the feature configuration during application startup.
-Configure::load('features');
-```
-
 In your `Application::services()` method add the following:
 
 ```php
@@ -104,13 +103,6 @@ return [
 ];
 ```
 
-Next, in `config/bootstrap.php` add the following:
-
-```php
-// Load the feature configuration during application startup.
-Configure::load('features');
-```
-
 In your `Application::services()` method add the following:
 
 ```php
diff --git a/src/FeatureFlagsPlugin.php b/src/FeatureFlagsPlugin.php
index 60db58d..b323f9f 100644
--- a/src/FeatureFlagsPlugin.php
+++ b/src/FeatureFlagsPlugin.php
@@ -5,6 +5,8 @@
 
 use Cake\Console\CommandCollection;
 use Cake\Core\BasePlugin;
+use Cake\Core\Configure;
+use Cake\Core\PluginApplicationInterface;
 
 /**
  * Plugin for FeatureFlags
@@ -12,10 +14,7 @@
 class FeatureFlagsPlugin extends BasePlugin
 {
     /**
-     * Add commands for the plugin.
-     *
-     * @param \Cake\Console\CommandCollection $commands The command collection to update.
-     * @return \Cake\Console\CommandCollection
+     * @inheritDoc
      */
     public function console(CommandCollection $commands): CommandCollection
     {
@@ -26,4 +25,11 @@ public function console(CommandCollection $commands): CommandCollection
 
         return $commands;
     }
+
+    public function bootstrap(PluginApplicationInterface $app): void
+    {
+        parent::bootstrap($app);
+
+        Configure::load('features');
+    }
 }

From 3a1916140ec47f4295bbbdb3c0e1cdb2e0bc9f21 Mon Sep 17 00:00:00 2001
From: Michael Hoffmann <michi@hey.com>
Date: Wed, 31 Jul 2024 00:04:35 +0200
Subject: [PATCH 2/2] CS

---
 src/FeatureFlagsPlugin.php | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/FeatureFlagsPlugin.php b/src/FeatureFlagsPlugin.php
index b323f9f..6d21d86 100644
--- a/src/FeatureFlagsPlugin.php
+++ b/src/FeatureFlagsPlugin.php
@@ -26,6 +26,9 @@ public function console(CommandCollection $commands): CommandCollection
         return $commands;
     }
 
+    /**
+     * @inheritDoc
+     */
     public function bootstrap(PluginApplicationInterface $app): void
     {
         parent::bootstrap($app);