Git Product home page Git Product logo

activecampaign-php's Introduction

ActiveCampaign PHP Wrapper (under development)

This is an ActiveCampaign API v3 Wrapper for PHP 7.0+. This PHP SDK contains methods for easily interacting with the ActiveCampaign API. Below there are some examples to get you started. For additional examples and explanations, see the documentation.

API Wrapper Logic

The structure is a little bit different than written in the official documentation. We've two logical module levels instead of one: Module / Resource. (To organize resources into logical groups.)

deals โ†’ Deals / Deals

The E-Commerce functions available under Ecommerce module instead of Deep Data group. (To be more trivial and to prepare for more resources in the future, like products.)

ecomCustomers โ†’ Ecommerce / Customers

Credentials

To be able to use ActiveCampaign API you need the API URL and the API Key belong to your account. You can find this information in your account under Settings / Developer, API Access section.

API URL looks like this: https://{{account}}.api-us1.com API Key looks like this: d41d8cd98f00b204e9800998ecf8427ed41d8cd98f00b204e9800998ecf8427ed41d8cd9

Settings URL: https://{{account}}.activehosted.com/admin/main.php?action=settings#tab_api

Installation

To install this wrapper, you need to use Composer in your project. If you are not using Composer yet, here's how to install:

curl -sS https://getcomposer.org/installer | php

via Composer

composer require balint-horvath/activecampaign-php

Phar

php composer.phar require balint-horvath/activecampaign-php

Basic Usage

You should always use the autoloader of Composer in your application to automatically load the your dependencies. All examples assumes you've already have included in your file:

require 'vendor/autoload.php';
use BalintHorvath\ActiveCampaign;

Instance

Creating a new instance with API URL and Key. Later we'll refer for it as $ActiveCampaign in the examples.

$ActiveCampaign = new ActiveCampaign("{{URL}}", "{{KEY}}");

Usage

use BalintHorvath\ActiveCampaign\ActiveCampaign;

Aliasing

Using inside a class under different access name:

use BalintHorvath\ActiveCampaign\ActiveCampaign as ActiveCampaignWrapper;

class ActiveCampaign
{

    public function __construct(){
        $ActiveCampaign = new ActiveCampaignWrapper("{{URL}}", "{{KEY}}");
    }
    
}

Using Modules

In general, calls on resources look like this:

$ActiveCampaign->{Module}->{Resource}->{Method}($id, $properties);

For example:

$customerID = $ActiveCampaign->Ecommerce->Customer->get($id);

Complete Example

For example:

$ActiveCampaign = new ActiveCampaignWrapper("{{URL}}", "{{KEY}}");
$customerID = $ActiveCampaign->Ecommerce->Customer->get($id);

Dependencies

Developer Dependencies

  • Kahlan 4 (kahlan/kahlan:^4.0)

Unit & BDD Test

This package has included test cases for Kahlan.

PSR

PSR-4 Autoload

  • BalintHorvath\ActiveCampaign\
  • BalintHorvath\ActiveCampaign\Spec\

activecampaign-php's People

Stargazers

 avatar

Watchers

 avatar  avatar

activecampaign-php's Issues

Composer not working

Hi, the project cannot be installed with composer, I cannot find in packagist either

The error:

Could not find package balint-horvath/activecampaign-php at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.