codivores/selligent

Selligent 客户端 API。用于通过 PHP 管理您的 Selligent 数据。

v1.1.4 2019-05-20 09:39 UTC

README

一个简单的 PHP 库,帮助您与 Selligent Individual 和 Broadcast API 进行交互。

基于 mediapart/selligent 的分支,允许 "symfony/config: ^4.1" 依赖

用法

<?php # example.php

require './vendor/autoload.php';

use Mediapart\Selligent\Connection;
use Mediapart\Selligent\Transport;
use Mediapart\Selligent\Properties;


/* connect you to your Selligent API server */
$connection = new Connection();
$client = $connection->open([
    'login' => '*****',
    'password' => '*****',
    'wsdl' => 'http://emsecure/individual?wsdl',
]);

/*
    Example : Trigger the TESTGATE campaign to an user.
    We will register the user first an then, we will trigger
    the campaign with a custom message :
 */
try {

    $transport = new Transport($client);

    $user = new Properties();
    $user['NAME'] = 'Foo Bar';
    $user['MAIL'] = 'foo@bar.tld';

    $userId = $transport
        ->setList($config['list'])
        ->subscribe($user)
    ;

    $inputData = new Properties();
    $inputData['MESSAGE'] = 'Lorem ipsum dolor sit amet conceptuem.';

    $result = $transport
        ->setCampaign($config['campaign'])
        ->triggerCampaign($userId, $inputData)
    ;

} catch (\Exception $e) {
    echo 'something bad happens.';
}

您可以从 API 中使用完整的 HTML 发布活动

安装

只需使用 Composer 安装此包。

composer require codivores/selligent

测试

开箱即用的测试

./vendor/bin/phpunit

如果没有设置 某些环境变量,某些测试将被跳过。例如,在 real 测试套件中的测试。

阅读更多