定制 dwijonarko/php-kirimemail 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

  1. Get All Lists
$lists = new Lists($config);
$result = $lists->getAll();
  1. Get List By Id
$lists = new Lists($config);
$result = $lists->getById($listID);
  1. Create List
$lists = new Lists($config);
$list_name = 'List Name';
$result = $lists->create($list_name);
  1. Update List
$lists = new Lists($config);
$list_name = "Update Name";
$result = $lists->update($list_id,$list_name);
  1. Delete List
$lists = new Lists($config);
$result = $lists->delete($list_id);

Subscriber

  1. Get All Subscriber
$subscribers = new Subscribers($config);
$result = $subscribers->getAll();
  1. Get Subscriber By Id
$subscribers = new Subscribers($config);
$result = $subscribers->getById($id);
  1. Get Subscriber By Email
$subscribers = new Subscribers($config);
$result = $subscribers->getByEmail($subscriber_email);
  1. 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);
  1. 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);
  1. 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);
  1. Delete Subscriber
$subscribers = new Subscribers($config);
$result = $subscribers->getAll();

Subscriber Field

  1. Get All Subscriber Field
$subscriber_field = new SubscriberFields($config);
$result = $subscriber_field->getAll();
  1. Get Subscriber Field By Id
$subscriber_field = new SubscriberFields($config);
$result = $subscriber_field->getById($subsciber_field_id);
  1. Create Subscriber Field
$subscriber_field = new SubscriberFields($config);
$subscriber_field_param = [
	'name' => 'Address',
    'type' => 'textarea',
];
$result = $subscriber_field->create($subscriber_field_param);
  1. Update Subscriber Field
$subscriber_field = new SubscriberFields($config);
$subscriber_field_param = [
	'name' => 'Address',
    'type' => 'textarea',
];
$result = $subscriber_field->updpate($id,$subscriber_field_param);
  1. Delete Subscriber Field
$subscriber_field = new SubscriberFields($config);
$result = $subscriber_field->delete($subscriber_field_id);

Form

  1. Get All Form
$form = new Forms($config);
$result = $form->getAll();
  1. Get Form By Id
$form = new Forms($config);
$result = $form->getById($form_id);
  1. 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

  1. Get All Landing Page
$landing = new LandingPages($config);
$result = $landing->getAll();
  1. Get Landing Page By Id
$landing = new LandingPages($config);
$result = $landing->getById($form_id);
  1. 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

  1. Get All Broadcast
$broadcast = new Broadcasts($config);
$result = $broadcast->getAll();
  1. Get Broadcast By GUID
$broadcast = new Broadcasts($config);
$result = $broadcast->getByGuid($broadcast_guid);
  1. 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);
  1. 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);
  1. Delete Broadcast
$broadcast = new Broadcasts($config);
$result = $broadcast->update($broadcast_guid);

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-11-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固