firewards/convertkit-php-api
Composer 安装命令:
composer require firewards/convertkit-php-api
包简介
Simple access interface to ConvertKit's web API.
README 文档
README
Unofficial ConvertKit PHP API for v3.
This package makes it simple to access ConvertKit's web API. Checkout https://developers.convertkit.com for more information on ConvertKit's API.
Install
Via Composer
$ composer require firewards/convertkit-php-api
Requirements
The following versions of PHP are supported.
- PHP 5.6
- PHP 7.0
- PHP 7.1
- PHP 7.2
- PHP 7.3
API Key
All API calls require an API Key. You can find your API Key in the ConvertKit Account page.
API Secret
Some API calls require an API Secret. All calls that require the api key will also work with the api secret, there's no need to use both. This key grants access to sensitive data and actions on your subscribers.
Usage
Start by using ConvertKit API and creating an instance with your ConvertKit API key
$api = new \Firewards\Apis\ConvertKit($api_key, $api_secret);
Examples
Get all Subscribers
Get all subscribers using pagination.
$i = 0; while ($subscribers = $api->getSubscribers($i++)) { if (!isset($subscribers->subscribers) || count($subscribers->subscribers) === 0) { break; } var_dump($subscribers); }
Get all Custom Fields
$customFields = $api->getCustomFields();
Create a Custom Field
$lastNameField = $api->createCustomField('last_name');
Update subscriber
Updates a subscriber and adds info to a custom field 'last_name'.
$subscriberId = '1234'; $lastNameField = $api->updateSubscriber($subscriberId, ['last_name' => 'Stücken']);
Get Tags
Retrieve all tags.
$tags = $api->getTags();
Add Subscriber to Tag
Adds a subscriber to a specific tag.
$added = $api->addSubscriberToTag($tagId, $email);
Subscribe to a form
Add a subscriber to a form. The $subscribed response will be an object.
$tag_id = '99999'; // This tag must be valid for your ConvertKit account. $options = [ 'email' => 'test@test.com', 'name' => 'Full Name', 'first_name' => 'First Name', 'tags' => $tag_id, 'fields' => [ 'phone' => 134567891243, 'shirt_size' => 'M', 'website_url' => 'testurl.com' ] ]; $subscribed = $api->form_subscribe($this->test_form_id, $options);
Get Subscriber ID
Get the ConvertKit Subscriber ID for a given email address.
$subscriber_id = $api->get_subscriber_id( $email );
Get Subscriber
Get subscriber data for a ConvertKit Subscriber.
$subscriber = $api->get_subscriber( $subscriber_id );
Get Subscriber Tags
Get all tags applied to a Subscriber.
$subscriber_tags = $api->get_subscriber_tags( $subscriber_id );
Add Tag to a Subscriber
Apply a tag to a Subscriber.
$tag_id = '99999'; // This tag must be valid for your ConvertKit account. $api->add_tag(tag_id, [ 'email' => 'test@test.com' ]);
Rate limiting
Please note that ConvertKit is rate limiting requests by 120 requests per minute. If your request rate exceeds the limit, ConvertKit PHP Api will throw a RateLimitExcededException.
License
The MIT License (MIT). Please see License File for more information.
Sponsor
This package is sponsored by www.firewards.com, Firewards makes it easy to setup a referral and rewards program for your email list and newsletter.
firewards/convertkit-php-api 适用场景与选型建议
firewards/convertkit-php-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 66 次下载、GitHub Stars 达 2, 最近一次更新时间为 2020 年 06 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 firewards/convertkit-php-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 firewards/convertkit-php-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 66
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-20