1

For a client I need to connect a rather complex contact form with the Zoho CRM. They're offering a PHP SDK which sounds great, but I can't get it to work. It's very likely that I'm just stupid, because I can't even include the SDK to just call the initial setup method.

The documentation says (under "Using the PHP SDK") to include the following line where needed:

require ‘vendor/autoload.php’

That doesn't seem to be needed, as it's already done in the main index.php by Craft itself.

I want to use the SDK within a service class I've created under modules/services. So within my class I tried the following:

require "../vendor/zohocrm/php-sdk/src/index.php";

That's getting the the index.php from the SDK but when I'm calling the method ZCRMRestClient::initialize() I just get the following error message:

Class 'modules\services\ZCRMRestClient' not found

I'm probably missing some really basic stuff but I just don't know what else to do.

0

Assuming you've got Composer installed from the command line, you can navigate to your project's root (where your project's composer.json file lives), then run this from the command line:

composer require zohocrm/php-sdk

From there, Composer and Craft pretty much take care of everything, including setting up the autoloading and you can reference ZCRMRestClient::initialize(); from your module/service.

|improve this answer|||||
  • Thanks for your answer. I'm pretty sure I tried it, but in the end the problem was that I tried calling it as ZCRMRestClient::initialize(); and not as \ZCRMRestClient::initialize();˚, so with a slash at the beginning. I also tried use ZCRMRestClient` and then calling it without the slash, but that didn't work — maybe I should learn a bit more about the use statement ;-) – Robert Cordes Dec 16 '18 at 15:55

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.