2017 © Pedro Peláez
 

library convertloop-php

A PHP client of the ConvertLoop API

image

convertloop/convertloop-php

A PHP client of the ConvertLoop API

  • Wednesday, December 13, 2017
  • by germanescobar
  • Repository
  • 2 Watchers
  • 1 Stars
  • 156 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 5 % Grown

The README.md

ConvertLoop PHP API Client

A PHP client of the ConvertLoop REST API. You can sign up for a ConvertLoop account at http://convertloop.co., (*1)

Installation

Requirements

PHP 5.3.3 and later., (*2)

Composer

To install this library using Composer run the following command:, (*3)

composer require convertloop/convertloop-php

To use it, use Composer's autoload:, (*4)

require_once('vendor/autoload.php');

Getting Started

First, you need to create an instance of ConvertLoop\ConvertLoop class passing your app_id and api_key:, (*5)

$convertloop = new \ConvertLoop\ConvertLoop("app_id", "api_key", "v1");

You are now ready to start calling the API methods:, (*6)

Creating or updating a person

You need to pass at least one of the following: pid, user_id or email to identify a user. Use pid when you are updating a guest of your site (you can obtain this value from the cookie dp_pid). Use user_id to match the id of the user in your application., (*7)

$person = array(
    "email" => "german.escobar@convertloop.co",
    "first_name" => "German",
    "last_name" => "Escobar",
    "plan" => "free"
);
$convertloop->people()->createOrUpdate($person);

Any key different to pid, user_id, email, first_seen_at, last_seen_at, add_to_segments, and remove_from_segments will be treated as a custom attribute of the person., (*8)

You can add or remove people from a segment ussing the  add_to_segments and remove_from_segments keys:, (*9)

$person = array(
    "email" => "german.escobar@convertloop.co",
    "add_to_segments" => array("Learn Something"),
    "remove_from_segments" => array("Segment 1")
);
$convertloop->people()->createOrUpdate($person);

Tracking an event

You can track an event for any person:, (*10)

$person = array("email" => "german.escobar@convertloop.co");
$event = array(
    "name" => "Billed",
    "person" => $person,
    "metadata" => array("credits" => 1000),
    "ocurred_at" => time()
);
$convertloop->eventLogs()->send($event);

If you don't specify the ocurred_at key, the current time will be used. You can use the person key to add custom attributes to that person, or add or remove that person to/from segments., (*11)

The Versions

13/12 2017

dev-master

9999999-dev

A PHP client of the ConvertLoop API

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

by German Escobar

17/12 2016

0.1.0

0.1.0.0

A PHP client of the ConvertLoop API

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

by German Escobar