leroy-merlin-br / exacttarget-client by leroy-robot

Easy way to interact with ExactTarget REST API in Laravel
9,806
3
24
Package Data
Maintainer Username: leroy-robot
Package Create Date: 2015-07-30
Package Last Update: 2023-08-11
Language: PHP
License: MIT
Last Refreshed: 2024-11-22 15:00:15
Package Statistics
Total Downloads: 9,806
Monthly Downloads: 56
Daily Downloads: 0
Total Stars: 3
Total Watchers: 24
Total Forks: 3
Total Open Issues: 0

ExactTarget API wrapper for PHP and Laravel 4.2

A wrapper to ExactTarget REST API.

Get started

[TODO]

Usage

Vanilla PHP

<?php
$guzzleClient   = new \GuzzleHttp\Client();
$requestBuilder = new \LeroyMerlin\ExactTarget\RequestBuilder($guzzleClient);
$token          = new \LeroyMerlin\ExactTarget\Token('YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET', $requestBuilder);
$client         = new \LeroyMerlin\ExactTarget\Client($token, $requestBuilder);

$parameters = [
    // optional
    // 'some-url-param' => 'some-value'
    'data' => [
        'email' => 'johndoe@example.com',
        'validators' => ['SyntaxValidator', 'MXValidator', 'ListDetectiveValidator'],
    ],
];

try {
    $response = $client->validateEmail($parameters);
    var_dump((string) $response->getBody());
} catch (\LeroyMerlin\ExactTarget\Exception\ExactTargetClientException $error) {
    var_dump($error->getCode(), $error->getMessage());
}

Laravel 4.2

$client = App::make('LeroyMerlin\ExactTarget\Client');

// As in https://code.exacttarget.com/apis-sdks/rest-api/v1/address/validateEmail.html
$parameters = [
    // optional
    // 'some-url-param' => 'some-value'
    'data' => [
        'email' => 'johndoe@example.com',
        'validators' => ['SyntaxValidator', 'MXValidator', 'ListDetectiveValidator'],
    ],
];

try {
    $response = $client->validateEmail($parameters);
    var_dump((string) $response->getBody());
} catch (\LeroyMerlin\ExactTarget\Exception\ExactTargetClientException $error) {
    var_dump($error->getCode(), $error->getMessage());
}