mediapart / selligent
此包已被废弃,不再维护。没有建议的替代包。
Selligent 客户端 API。用于通过 PHP 管理您的 Selligent 数据。
v1.1.3
2017-06-15 12:26 UTC
Requires
- php: >=5.6
- psr/log: ^1.0
- symfony/config: ^3.1|^2.8
- symfony/yaml: ^3.2|^2.8
Requires (Dev)
- phpunit/phpunit: ^5.7
README
一个简单的 PHP 库,帮助您与 Selligent Individual 和 Broadcast API 进行交互。
用法
<?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 mediapart/selligent
测试
开箱即用执行测试
./vendor/bin/phpunit
未经设置某些环境变量,某些测试将被跳过。例如,在 real
测试套件中的测试。