Closed zebrastribe closed 2 years ago
This is old, but maybe this can help someone else. For some reason this wrapper doesn't load the classes in composer's autoloader, so you have to manually require the src/ActiveCampaign.php file. Here's a trimmed down version of what I'm doing in WordPress, which seems to work fine.
use TestMonitor\ActiveCampaign\ActiveCampaign;
use TestMonitor\ActiveCampaign\Resources\Contact;
require( get_template_directory() . '/lib/vendor/testmonitor/activecampaign/src/ActiveCampaign.php' );
$ac = new ActiveCampaign( ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY );
$contact = $ac->findOrCreateContact( $email, $first_name, $last_name, $phone );
if ( $contact instanceof Contact ) {
$contact->subscribe( 123 ); // List ID to add contact to
}
Thank you for the reported issue. I will close it for now, if you want to change something feel free to start a new PR.
Hi
I have some problems with using the wrapper:
First the path in: require DIR.'/../vendor/autoload.php'; does not find the autoload.php file
So I changed it to: require DIR . '/vendor/autoload.php';
define('ACTIVE_CAMPAIGN_URL','https://xxx.api-us1.com'); define('ACTIVE_CAMPAIGN_KEY','xxx');
$activeCampaign = new ActiveCampaign(ACTIVE_CAMPAIGN_URL, ACTIVE_CAMPAIGN_KEY);
The ActiveCampaign Class is not found...
why?