diff --git a/README.md b/README.md index b74a4be..14efdb4 100644 --- a/README.md +++ b/README.md @@ -31,4 +31,15 @@ Links: composer require php-di/php-di ``` -[Next step >>>](https://github.com/wpify/plugin-tutorial/tree/02-scoper) +### 02 - WPify Scoper + +In this step, we are adding the WPify Scoper to the plugin, so that the dependencies are not conflicting with other +plugins. + +links: [WPify Scoper](https://packagist.org/packages/wpify/scoper) + +```bash +composer require wpify/scoper +``` + +[Next step >>>](https://github.com/wpify/plugin-tutorial/tree/03-custom-fields) diff --git a/bootstrap.php b/bootstrap.php index ab388f9..26ec16e 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -13,12 +13,14 @@ * Domain Path: /languages */ -use DI\Container; -use DI\ContainerBuilder; -use DI\DependencyException; -use DI\NotFoundException; +use WpifyPluginTutorialDeps\DI\Container; +use WpifyPluginTutorialDeps\DI\ContainerBuilder; +use WpifyPluginTutorialDeps\DI\DependencyException; +use WpifyPluginTutorialDeps\DI\NotFoundException; use WpifyPluginTutorial\Plugin; +require 'deps/scoper-autoload.php'; +require 'deps/autoload.php'; require 'vendor/autoload.php'; /** diff --git a/composer-deps.json b/composer-deps.json new file mode 100644 index 0000000..aabaa7b --- /dev/null +++ b/composer-deps.json @@ -0,0 +1,6 @@ +{ + "require": { + "php": "^8.0", + "php-di/php-di": "^7.0" + } +} diff --git a/composer.json b/composer.json index 3c63f0e..faa9f7d 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,19 @@ } ], "require": { - "php": "^8.0", - "php-di/php-di": "^7.0" + "php": "^8.0" + }, + "require-dev": { + "wpify/scoper": "^3.0" + }, + "config": { + "allow-plugins": { + "wpify/scoper": true + } + }, + "extra": { + "wpify-scoper": { + "prefix": "WpifyPluginTutorialDeps" + } } }