cancel
Showing results for 
Search instead for 
Did you mean: 

Error: Class 'Ctct\ConstantContact' not found

SOLVED
Highlighted
Occasional Participant

Error: Class 'Ctct\ConstantContact' not found

I tried to integrate Constant Contact API in Drupal 8 using a custom module. In my local windows OS, it works fine but when it's tested on Linux / Mac OS I get the following error: "Error: Class 'Ctct\ConstantContact' not found" In Linux, PHP is 7.

 

The website encountered an unexpected error. Please try again later.
Error: Class 'Ctct\ConstantContact' not found in Drupal\constant_contact\Form\ConstantContactBlockForm->callConstantContactAPI() (line 227 of modules/custom/constant_contact/src/Form/ConstantContactBlockForm.php).

 

In line number 227, I have called 

$ctct = new ConstantContact($APIKEY);

 

Thank you for your suggestion in advance.

Tags (1)
3 REPLIES 3
CTCT Employee

Re: Error: Class 'Ctct\ConstantContact' not found

Hello @JonathonS36,

 

I'm sorry to hear that you are having issues attempting to integrate Constant Contact. For further assistance in regards to this and other API's please refer to this article. If you have further questions, you can also reach out to webservices(at)constantcontact.com 


Jon_G
Community & Social Media Support

Did I answer your question? If so, please mark my post as an "Accepted Solution" by clicking the Accept as Solution button in the bottom right hand corner of this post.

Anyone can be a marketer! Visit our Blog & Resources page to brush up on the latest tips and tricks.
Occasional Participant

Re: Error: Class 'Ctct\ConstantContact' not found

Thank you @Jon_G for the reply.

I guess you for get to mention the article link as you have stated "For further assistance in regards to this and other API's please refer to this article.

Thanks.

Occasional Participant

Re: Error: Class 'Ctct\ConstantContact' not found

I found the solution. It's actually due to the wrong path for the libraries "src/ and vendor/". 

If you are working on Drupal 8, the path should be as : 

require drupal_get_path('module', 'constant_contact').'/lib/src/Ctct/autoload.php';
require drupal_get_path('module', 'constant_contact').'/lib/vendor/autoload.php';

 

I have created a custom module to link up with Constant Contact API using php_sdk libraries. And those libraries reside under 'lib/' folder.