This composer plugin will help you add custom namespace to Stripe SDK for PHP so that you can easily use the custom namespaced Stripe SDK in your WordPress plugins.
Using this will help you avoid conflicts with other WordPress plugins who are using the same Stripe PHP SDK with different versions.
Add the composer.json
and scoper.inc.php
in your WordPress plugin for development only. Don't send this files in production.
If your WordPress plugin has its own composer.json
then merge it with our composer.json
file.
- Replace the word
WP\\Stripe\\
withCustomNamespace\\Stripe\\
underautoload
parameter incomposer.json
- Replace the prefix
WP
withCustomNamespace
inscoper.inc.php
After moving the files and following the steps above, run the below mentioned command and it will automagically convert the Stripe SDK under vendor
folder with your custom namespace.
$ composer install
That's it! You're done.
If you're facing issues with generating files properly or any random error arises. Then, follow the steps as mentioned:
- Remove
composer.lock
file. - Clear Composer cache.
$ composer clear-cache