dicr/yii2-esputnik
Composer 安装命令:
composer require dicr/yii2-esputnik
包简介
ESputnik API for Yii2
关键字:
README 文档
README
API: https://esputnik.com/api/
Конфигурация
$config = [
'components' => [
'esputnik' => [
'class' => dicr\esputnik\ESputnikAPI::class,
'user' => 'ваш_логин',
'keyPass' => 'ваш_ключ_или_пароль'
]
]
];
Использование
/** @var dicr\esputnik\ESputnikAPI $api */
$api = Yii::$app->get('esputnik');
/** @var dicr\esputnik\request\ContactsRequest $req */
$req = $api->contactsRequest([
'contacts' => [
[
'firstName' => 'Иван',
'channels' => [
['type' => dicr\esputnik\entity\Channel::TYPE_EMAIL, 'value' => 'ivan@mail.com']
]
],
[
'firstName' => 'Сергей',
'channels' => [
['type' => dicr\esputnik\entity\Channel::TYPE_EMAIL, 'value' => 'sergey@mail.com']
]
]
],
'dedupeOn' => dicr\esputnik\request\ContactsRequest::DEDUPE_ON_EMAIL,
'groupNames' => ['Покупатели'],
'eventKeyForNewContacts' => 'NewUsers'
]);
/** @var dicr\esputnik\request\ContactsResponse $res */
$res = $req->send();
if (! empty($res->errorMessage)) {
throw new yii\base\Exception($res->errorMessage);
}
echo 'Передано: ' . count($req->contacts) . " контактов\n";
if (! empty($res->failedContacts)) {
echo 'Пропущено: ' . count($res->failedContacts) . " контактов\n";
}
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2021-05-20