protected function activeCampaignAPI($api, $data)
 {
     $config_array = Config::get('services.activecampaign');
     $config = new \AC\Arguments\Config($config_array);
     $ac = new ActiveCampaign($config);
     if (!(int) $ac->credentials_test()) {
         Log::info('ActiveCampaign: Access denied, Invalid credentials (URL and/or API key).');
     }
     $result = $ac->api($api, $data);
     if ((int) $result->success) {
         if (property_exists($result, 'subscriber_id')) {
             Log::info("ActiveCampaign successful API call (ID " . (int) $result->subscriber_id . ")!");
             return ['ok', (int) $result->subscriber_id];
         } else {
             Log::info("ActiveCampaign successful API call. " . var_export($result, true));
             return ['ok', ''];
         }
     } else {
         Log::info("ActiveCampaign ERROR: API call failed. " . $result->error);
         // request failed
         return ['error', $result->error];
     }
 }
<?php

use AC\ActiveCampaign;
use AC\Arguments\Config;
include 'src/AC/config.php';
$conf = new Config(array('url' => 'yourURL', 'apiKey' => 'yourAPIKEY', 'apiUser' => 'optionalUserName', 'apiPAss' => 'andPassword'));
$ac = new ActiveCampaign($conf);
$out = array();
/*
 * TEST API CREDENTIALS.
 */
if (!(int) $ac->credentials_test()) {
    echo "<p>Access denied: Invalid credentials (URL and/or API key).</p>";
    exit;
} else {
    $out[] = 'Credentials valid! Proceeding...';
    //echo "<p>Credentials valid! Proceeding...</p>";
}
/*
 * VIEW ACCOUNT DETAILS.
 */
$account = $ac->api("user/view?id=2");
$out[] = $account;
/*
	echo "<pre>";
	print_r($account);
	echo "</pre>";*/
/*
 * ADD NEW LIST.
 */
$list = array("name" => "List 3", "sender_name" => "My Company", "sender_addr1" => "123 S. Street", "sender_city" => "Chicago", "sender_zip" => "60601", "sender_country" => "USA");