I have a composer.json file that looks like this:
{
“require”: {
“google/analytics-data”: “^0.9.3”,
“google/cloud”: “^0.196.0”
}
}
The created vendor directory gets moved to /usr/lib/plugin-name so that it can be used by multiple sites. It gets loaded by the plugin file like this:
<?php
/**
* @package PluginName
*/
namespace PluginName;
if (wp_get_environment_type() === ‘development’) {
if (file_exists(dirname(__FILE__) . ‘/vendor/autoload.php’)) {
require_once dirname(__FILE__) . ‘/vendor/autoload.php’;
}
} else {
if (file_exists(‘/usr/lib/plugin-name/autoload.php’)) {
require_once ‘/usr/lib/plugin-name/autoload.php’;
}
}
However I get conflicts when there is another active package that uses guzzle.
When I research this issue, it appears that I need to prefix the vendor directory but every search gets SEO hijacked by php-prefixer, a paid service. How am I actually supposed to have two plugins that use Guzzle?
Thanks for any help!
[ad_2]