承接 markuszeller/cleverreach 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

markuszeller/cleverreach

最新稳定版本:v0.0.1

Composer 安装命令:

composer require markuszeller/cleverreach

包简介

CleverReach REST API v3 client

README 文档

README

This library makes it easy to interact with the CleverReach REST API v3.

Forked from https://github.com/rdoepner/cleverreach. Moved to own namespace, because pull requests weren't merged nor any other reaction from author.

Installation

composer require markuszeller/cleverreach

Usage

Get an access token

use markuszeller\CleverReach\ApiManager;
use markuszeller\CleverReach\Http\Guzzle as HttpAdapter;

// Create an HTTP adapter
$httpAdapter = new HttpAdapter();

// Authorize your app by credentials
$response = $httpAdapter->authorize('<CLIENT_ID>', '<CLIENT_SECRET>');

if (isset($response['access_token'])) {
    // Persist the access token for later use...
}

Initialize an API manager

use markuszeller\CleverReach\ApiManager;
use markuszeller\CleverReach\Http\Guzzle as HttpAdapter;

// Create an HTTP adapter
$httpAdapter = new HttpAdapter(
    [
        'access_token' => '<ACCESS_TOKEN>',
    ]
);

// Create the API manager
$apiManager = new ApiManager($httpAdapter);

Create an inactive subscriber

$response = $apiManager->createSubscriber(
    '<EMAIL>',
    '<GROUP_ID>',
    false, // not activated
    [
        'salutation' => 'Mr.',
        'firstname' => 'John',
        'lastname' => 'Doe',
    ]
);

if (isset($response['id'])) {
    // ...
}

Trigger Double-Opt-In email for an inactive subscriber

$response = $apiManager->triggerDoubleOptInEmail('<EMAIL>', '<FORM_ID>');

if (isset($response['success'])) {
    // ...
}

Trigger Double-Opt-Out email for an active subscriber

$response = $apiManager->triggerDoubleOptOutEmail('<EMAIL>', '<FORM_ID>');

if (isset($response['success'])) {
    // ...
}

Get subscriber

$response = $apiManager->getSubscriber('<EMAIL>', '<GROUP_ID>');

if (isset($response['id'])) {
    // ...
}

Set active status of a subscriber

$response = $apiManager->getSubscriber('<EMAIL>', '<GROUP_ID>', '<TRUE_OR_FALSE>');

if (true === $response) {
    // ...
}

Delete subscriber

$response = $apiManager->deleteSubscriber('<EMAIL>', '<GROUP_ID>');

if (true === $response) {
    // ...
}

Examples for reading Mailings

// Get a list of all Mailings
// You can provide a state, i.e. draft
$mailings = $apiManager->getMailings(0, ApiManager::MAILING_STATE_DRAFT);

// Get a specific Mailing
// returns a Mailing Object
$mailing = $apiManager->getMailing(MAILING_ID);

// Get Specific Mailing details
$mailingLinks = $apiManager->getMailingLinks(MAILING_ID);
$mailingOrders = $apiManager->getMailingOrders(MAILING_ID);
$mailingChannels = $apiManager->getMailingChannels();
$mailingChannel = $apiManager->getMailingChannel(CHANNEL_ID);

Update a Mailing

// Read one for updating
$mailing = $apiManager->getMailing(MAILING_ID);

// Create a fresh Mailing and Content instance with no data
$updatedMailing = new Mailing(MAILING_ID);
$content = new MailingContent();

// Get HTML content from "old"
$html = $mailingData->getContent()->getHtml();

// Inject a update message after body tag
$date = date(DATE_W3C);
$html = preg_replace("/(<body.*?>)/", "\$1\n<div>Automated update at {$date}</div>", $html);

// Place into Content entity and update Mailings content
$content->setHtml($html);
$updatedMailing->setContent($content);

// Update request (PUT)
$apiManager->updateMailing($updatedMailing);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-04-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固