dwijonarko/php-kirimemail
Composer 安装命令:
composer require dwijonarko/php-kirimemail
包简介
PHP helpers to comunicate with kirimemail api marketing easily
README 文档
README
The unofficial PHP client library for the Kirim.Email Marketing API. Official documentation for Kirim.Email Marketing api is here
Instalation
Option 1: Install via Packagist
composer require --dev dwijonarko/php-kirimemail:dev-main
Or add the following to composer.json
{
"require": {
"dwijonarko/php-kirimemail": "dev-main"
}
}
Option 2: Install Manually
Clone the repo
git clone git@github.com:dwijonarko/phpkirimemail.git
In the client library project root, install all dependencies
composer install
Manually include vendor/autoload.php in your implementation
Quick Start
<?php
require_once('vendor/autoload.php');
use Dwijonarko\PHPKirimemail\Lists;
$config= [
'username'=>'YOURUSERNAME',
'api_token'=>'YOUR KIRIM EMAIL API TOKEN'
];
$lists = new Lists($config);
$result = $lists->getAll();
var_dump($result);
Functions
List
- Get All Lists
$lists = new Lists($config);
$result = $lists->getAll();
- Get List By Id
$lists = new Lists($config);
$result = $lists->getById($listID);
- Create List
$lists = new Lists($config);
$list_name = 'List Name';
$result = $lists->create($list_name);
- Update List
$lists = new Lists($config);
$list_name = "Update Name";
$result = $lists->update($list_id,$list_name);
- Delete List
$lists = new Lists($config);
$result = $lists->delete($list_id);
Subscriber
- Get All Subscriber
$subscribers = new Subscribers($config);
$result = $subscribers->getAll();
- Get Subscriber By Id
$subscribers = new Subscribers($config);
$result = $subscribers->getById($id);
- Get Subscriber By Email
$subscribers = new Subscribers($config);
$result = $subscribers->getByEmail($subscriber_email);
- Create Subscriber
$subscribers = new Subscribers($config);
$subscriber_params = [
'email' => 'email@example.com',
'full_name' => 'Full Name',
'lists' => $list_id,
'status' => 'subscribed',
'tags' => 'api,php',
'fields' => [
'phone' => '081234567890',
'address' => 'Jl. Jalan'
]]
$result = $subscribers->create($subscriber_params);
- Update Subscriber By Id
$subscribers = new Subscribers($config);
$subscriber_params = [
'email' => 'email@example.com',
'full_name' => 'Full Name',
'lists' => $list_id,
'status' => 'subscribed',
'tags' => 'api,php',
'fields' => [
'phone' => '081234567890',
'address' => 'Jl. Jalan'
]]
$result = $subscribers->update($subscriber_id,$subscriber_params);
- Update Subscriber By Email
$subscribers = new Subscribers($config);
$subscriber_params = [
'email' => 'email@example.com',
'full_name' => 'Full Name',
'lists' => $list_id,
'status' => 'subscribed',
'tags' => 'api,php',
'fields' => [
'phone' => '081234567890',
'address' => 'Jl. Jalan'
]]
$result = $subscribers->updateByEmail($subscriber_email,$subscriber_params);
- Delete Subscriber
$subscribers = new Subscribers($config);
$result = $subscribers->getAll();
Subscriber Field
- Get All Subscriber Field
$subscriber_field = new SubscriberFields($config);
$result = $subscriber_field->getAll();
- Get Subscriber Field By Id
$subscriber_field = new SubscriberFields($config);
$result = $subscriber_field->getById($subsciber_field_id);
- Create Subscriber Field
$subscriber_field = new SubscriberFields($config);
$subscriber_field_param = [
'name' => 'Address',
'type' => 'textarea',
];
$result = $subscriber_field->create($subscriber_field_param);
- Update Subscriber Field
$subscriber_field = new SubscriberFields($config);
$subscriber_field_param = [
'name' => 'Address',
'type' => 'textarea',
];
$result = $subscriber_field->updpate($id,$subscriber_field_param);
- Delete Subscriber Field
$subscriber_field = new SubscriberFields($config);
$result = $subscriber_field->delete($subscriber_field_id);
Form
- Get All Form
$form = new Forms($config);
$result = $form->getAll();
- Get Form By Id
$form = new Forms($config);
$result = $form->getById($form_id);
- Get Form By Url
$form = new Forms($config);
$parse_url = parse_url($url, PHP_URL_PATH);
if (!empty($parse_url)) {
$path = explode('/', $parse_url);
$form_url = end($path);
}else{
$form_url = $url;
}
$result = $form->getByUrl($form_url);
Landing Page
- Get All Landing Page
$landing = new LandingPages($config);
$result = $landing->getAll();
- Get Landing Page By Id
$landing = new LandingPages($config);
$result = $landing->getById($form_id);
- Get Landing Page By Url
$landing = new LandingPages($config);
$parse_url = parse_url($url, PHP_URL_PATH);
if (!empty($parse_url)) {
$path = explode('/', $parse_url);
$form_url = end($path);
}else{
$form_url = $url;
}
$result = $landing->getByUrl($form_url);
Broadcast
- Get All Broadcast
$broadcast = new Broadcasts($config);
$result = $broadcast->getAll();
- Get Broadcast By GUID
$broadcast = new Broadcasts($config);
$result = $broadcast->getByGuid($broadcast_guid);
- Create Broadcast Note: The message contains the subject and content. You can send a maximum of 3 messages.
$broadcast = new Broadcasts($config);
$param[
'title'=>'Title',
'sender'=>'Email Sender',
'messages[0][subject]'=>'Email Subject',
'messages[0]['content]'=>'Email content, ', //disallow css and js, read official docs for detail
'send_at'=>'2018-12-30 00:00:00',
'list'=>1
];
$result = $broadcast->create($params);
- Edit Broadcast Note: If the current broadcast is of type SPLIT, then you need to add all messages. If you add only one message, then the type will be SINGLE. The message sent must always be equal to the current Broadcast Message count.
$broadcast = new Broadcasts($config);
$param[
'title'=>'Title',
'sender'=>'Email Sender',
'messages[0][subject]'=>'Email Subject',
'messages[0]['content]'=>'Email content, ', //disallow css and js, read official docs for detail
];
$result = $broadcast->update($broadcast_guid,$params);
- Delete Broadcast
$broadcast = new Broadcasts($config);
$result = $broadcast->update($broadcast_guid);
dwijonarko/php-kirimemail 适用场景与选型建议
dwijonarko/php-kirimemail 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 11 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 dwijonarko/php-kirimemail 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dwijonarko/php-kirimemail 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-11-20