ossbrownie / esputnik
ESputnik 营销自动化系统。
0.1.3
2018-08-14 17:14 UTC
Requires
- php: >=5.4
- ext-curl: *
Requires (Dev)
- phpdocumentor/reflection-docblock: 2.0. *
- phpunit/phpunit: 4.8.35
README
ESputnik 营销自动化系统。
curl
PHP 的基本 CURL 封装器(有关 PHP 的 libcurl 扩展的更多信息,请参阅 https://php.ac.cn/curl)
需求
- PHP >= 5.4
- EXT-CURL = *
安装
在您的 composer 配置文件中的 "require" 部分添加一行
{ "require": { "ossbrownie/esputnik": "0.1.3" } }
用法
$eSputnik = new ESputnik( new HTTPClient( new CurlClient(), new Config([ 'login' => 'tester', 'password' => 'passwd' ]) ) ); { $version = $eSputnik->version(); } { $contact = new Contact(); $contact ->setFirstName('FName') ->setLastName('LName') ->setContactKey('contact@site.com'); $channelList = new ChannelList(); $channelList->add(new EmailChannel([ 'value' => 'tester@site.com' ])); $fieldList = new FieldList(); $fieldList ->add(new Field([ 'id' => 12345, 'value' => 'CustomValue1', ])) ->add(new Field([ 'id' => 12346, 'value' => 'CustomValue2', ])); $contact ->setFieldList($fieldList); $contact ->setChannelList($channelList); $subscribe = new Subscribe(); $subscribe ->setFormType('test_type') ->getGroups()->add(new Group([ 'name' => 'Test group' ])); $response = $eSputnik->contactSubscribe($contact, $subscribe); } { $addressbooks = $eSputnik->addressbooks(); } { $groups = $eSputnik->groups(); } { $params = new ParamList(); $params ->add(new Parameter([ 'name' => 'EmailAddress', 'value' => 'tester@site.com', ])); $eSputnik->event(new Event([ 'eventTypeKey' => 'test-test', 'keyValue' => 'test-' . time(), 'params' => $params ])) }
测试
要运行测试套件,您需要通过 composer 安装依赖项,然后运行 PHPUnit。
$> composer.phar install $> ./vendor/bin/phpunit --colors=always --bootstrap ./tests/bootstrap.php ./tests
许可证
HttpClient 在 MIT 许可证下授权MIT License
联系
欢迎提出问题、评论和建议: oss.brownie@gmail.com