PHP code example of convertloop / convertloop-php

1. Go to this page and download the library: Download convertloop/convertloop-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/ */

    

convertloop / convertloop-php example snippets


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

$person = array(
    "email" => "[email protected]",
    "first_name" => "German",
    "last_name" => "Escobar",
    "plan" => "free"
);
$convertloop->people()->createOrUpdate($person);

$person = array(
    "email" => "[email protected]",
    "add_to_segments" => array("Learn Something"),
    "remove_from_segments" => array("Segment 1")
);
$convertloop->people()->createOrUpdate($person);

$person = array("email" => "[email protected]");
$event = array(
    "name" => "Billed",
    "person" => $person,
    "metadata" => array("credits" => 1000),
    "ocurred_at" => time()
);
$convertloop->eventLogs()->send($event);

composer