firewards / getrevue-php
GetRevue的Web API的简单访问接口。
1.0.4
2021-12-08 23:14 UTC
Requires
- php: >=7.0
- ext-json: *
- guzzlehttp/guzzle: ^6.3
- monolog/monolog: 2.*
Requires (Dev)
- phpunit/phpunit: 9.*
This package is not auto-updated.
Last update: 2024-09-12 12:41:35 UTC
README
非官方的GetRevue PHP API,用于v2。
此包使访问GetRevue的Web API变得简单。更多信息请访问https://www.getrevue.co/api。
安装
通过Composer
$ composer require firewards/getrevue-php
要求
以下版本的PHP受到支持。
- PHP 7.0
- PHP 7.1
- PHP 7.2
- PHP 7.3
- PHP 7.4
API密钥
所有API调用都需要API密钥。您可以在GetRevue账户页面的“集成”选项卡下找到您的API密钥(滚动到底部)。
用法
首先使用GetRevueAPI并使用您的ConvertKit API密钥创建一个实例
$apiKey = "your-key-goes-here"; $api = new \Firewards\GetRevueApi($apiKey);
示例
向您的订阅者列表添加新电子邮件。
$subscriber = $this->api->addSubscriber("getrevue@firewards.com", 'firstName', 'lastName'); /** Return example: array(6) { ["id"]=> int(42840832) ["list_id"]=> int(64471) ["email"]=> string(26) "test_8658431@firewards.com" ["first_name"]=> string(9) "firstName" ["last_name"]=> string(8) "lastName" ["last_changed"]=> string(24) "2020-12-24T02:21:26.333Z" } */
通过电子邮件取消现有订阅者的订阅。 Revue不会返回任何成功或失败代码。
if ($api->unsubscribe("getrevue@firewards.com")) { // unsbuscribed }
获取所有订阅者并遍历它们。 Revue的API尚不支持分页。API将返回5000个订阅者。
foreach ($api->getSubscribers() as $subscriber) { /* * array(6) { ["id"]=> int(42840832) ["list_id"]=> int(64471) ["email"]=> string(26) "test_8658431@firewards.com" ["first_name"]=> string(9) "firstName" ["last_name"]=> string(8) "lastName" ["last_changed"]=> string(24) "2020-12-24T02:21:26.333Z" } */ }
获取所有可用列表(订阅者组)。
foreach ($api->getLists()) { }
使用其ID返回特定列表的信息。
$list = $api->getList(13212);
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。
赞助商
此包由www.firewards.com赞助,Firewards使您能够轻松设置电子邮件列表和时事通讯的推荐和奖励计划。