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..6d21d86 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,14 @@ public function console(CommandCollection $commands): CommandCollection return $commands; } + + /** + * @inheritDoc + */ + public function bootstrap(PluginApplicationInterface $app): void + { + parent::bootstrap($app); + + Configure::load('features'); + } }