PHP code example of skyfrog / activecampaign-api-php
1. Go to this page and download the library: Download skyfrog/activecampaign-api-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
skyfrog / activecampaign-api-php example snippets
namespace AcmeBundle\Service;
use AC\Arguments\Config,
AC\ActiveCampaign;
/**
* Your service class doc-block
*/
class YourService
{
/**
* @var \AC\ActiveCampaign
*/
protected $api = null;
/**
* @var \AC\Arguments\Config
*/
protected $config = null;
/**
* Is called by service locator
* @param array $config
* @return \AcmeBundle\Service\YourService
*/
public function setActiveCampaignConfig(array $config)
{
$this->config = new Config($config);
return $this;
}
public function getActiveCampaignConfig()
{
return $this->config;
}
/**
* Lazy-load the api interface
* @return \AC\ActiveCampaign
*/
public function getActiveCampaignAPI()
{
if ($this->api === null)
{
$this->api = new ActiveCampaign(
$this->getActiveCampaignConfig()
);
}
return $this->api;
}
}
/**
* Example method, perhaps to add to the ficticious class listed above
* @param array $contact
* @return \stdClass
**/
public function syncContact(array $contact)
{
//returns existing ActiveCampaign instance, or creates one if