I am trying to port the Infusionsoft module to Drupal 8 and I need to load the infusionsoft/php-sdk library. I have been racking my brain all day trying to figure this out, but I cannot get the class to autoload. I do not know if this is because it is a custom module and not hosted on drupal.org yet or what.

I have added the requirement to a composer.json file in the module:

  "require": {
    "infusionsoft/php-sdk": "dev-master",

And told the root composer.json file to include the module's composer.json file:

  "extra": {
    "merge-plugin": {
      "include": [
      "recurse": true,
      "replace": false,
      "merge-extra": false


composer update

and also tried

composer install

Both give me the vendor files. I have uploaded those files to the remote server's vendor directory, yet they are still not being loaded.

I have read several other posts on here and many other sites, but none of the answers are up-to-date with Drupal 8.5.2. And the composer manager module method is depreciated.

I don't know if this is an issue with their sdk's structure or if I need to upload a another/different file(s) to the server, but instantiating the class breaks.

use Infusionsoft\Infusionsoft;
$infusionsoft = new Infusionsoft([
  'clientId'     => $id,
  'clientSecret' => $secret,
  'redirectUri'  => $redirect,

Any help is greatly appreciated! Thanks!

  • I think your issue is that the infusionsoft/php-sdk library has a psr-0 autoload key, but needs a psr-4 autoload key. No idea how to resolve this though. Maybe you can fork? This answer shows what a psr-4 autoload key should look like. – sonfd Apr 24 '18 at 23:56
  • Thanks... that is what I was afraid of.... :/ I will see what I can figure out. – Coyote6 Apr 25 '18 at 0:21
  • 1
    No, there is no requirement to use psr-4, you can use whatever autoloading composer supports, can also be a static class map. The psr-4 requirement is just for drupal modules which have their classes loaded automatically – Berdir Apr 25 '18 at 6:14

Both give me the vendor files. I have uploaded those files to the remote server's vendor directory, yet they are still not being loaded.

What files did you upload exactly? It's not enough to upload just the new files from your package, installing packages with composer also updates its own autoloading files to make sure it knows where to load that and you probably forgot to upload those, that's the only explanation I have at least.

Try uploading all the files in vendor/composer as well or to be sure, all the files in vendor.

| improve this answer | |
  • Thank you! I had just uploaded the individual libraries that were added (14 of them), but did not realized it actually changed the composer library and others. I thought maybe it would update the composer.lock file, but those were identical from the pre/post update. Adding the composer library alone just threw an error. But uploading the entire vendor folder seemed to work. Appreciate it. – Coyote6 Apr 25 '18 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.