Don’t use composer packages or namespace them
-
Hello,
I’m using in a composer based WordPress stack and I’m having issues with with your plugin dependencies. Choosing Composer in the context of a WordPress plugin implies certain prerequisites and responsabilities. You have three (unique) solutions:
- Provide your plugin without autoload/vendor via Composer (as Yoast or ACF do) so that a WordPress project managed with Composer (which is very often the case on “pro” sites using Bedrock or equivalent stacks) is aware of your dependencies/constraints and can warn the user of a compatibility problem or manage the constraints of other dependencies (the whole point of a dependency manager).
- Prefix your dependencies (for example, with Yoast), which allows you to isolate your dependencies (by automatically modifying their namespace – PHPScoper does this very well) and avoid conflicts.
- You may provide a bundled plugin, but composing it should only be used for its autoload functionality (no dependencies).
Your plugin is using very popular dependencies (Monolog, Guzzle) that may conflict with a user based installation or another plugin.
If you intend to use external dependencies, please do it the right way.
The topic ‘Don’t use composer packages or namespace them’ is closed to new replies.