定制 rewake/sendlane 二次开发

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

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

rewake/sendlane

最新稳定版本:v1.0.1

Composer 安装命令:

composer require rewake/sendlane

包简介

Sendlane API SDK for PHP

关键字:

README 文档

README

This is a quick SDK for the Sendlane API (www.sendlane.com). Method names match the API endpoints to help keep things consistent and hopefully a bit easier to integrate with Sendlane.

Some Notes:

  • This library throws exceptions, which should be handled by your application
  • You can use this library as an instantiated object or statically
  • Please see Sendlane's API documentation for more information on how their API works: https://documenter.getpostman.com/view/7477734/S1TN5g5b?version=latest
  • I have a few instantiation tests in place, but will likely not have time to get around to writing more anytime soon

Examples

Instantiation

Basic Instantiation

try {
    
    // Create Sendlane object
    $sendlane = new Sendlane('subdomain', 'key', 'hash');
    
} catch (\Exception $e) {

    // Echo error message
    echo $e->getMessage();
}

Configuration After Instantiation

Allows the possibility of switching accounts without destroying and re-creating the Sendlane class (untested). The configure() method is also chain-able.

try {
    
    // Create Sendlane object
    $sendlane = new Sendlane();
    
    // Configure 
    $sendlane->configure('subdomain', 'key', 'hash');
    
} catch (\Exception $e) {

    // Echo error message
    echo $e->getMessage();
}

Add subscriber to a list

Object oriented call

try {
    
    // Create Sendlane object
    $sendlane = new Sendlane('subdomain', 'key', 'hash');
    
    // Add subscriber to a list
    $result = $sendlane->list_subscriber_add([
        'email' => 'test@test.com',
        'list_id' => 1
    ]);
    
} catch (\Exception $e) {

    // Echo error message
    echo $e->getMessage();
}

Static call

try {
    
    // Make static API call
    SendlaneClient::api(
        'subdomain',
        'list-subscriber-add',
        [
            'key' => 'your-api-key',
            'hash' => 'your-api-hash',
            'email' => 'user@domain.com',
            'list_id' => 1
        ]
    );
    
} catch (\Exception $e) {

    // Echo error message
    echo $e->getMessage();
}

Get user details

Note that this method has required arguments. For endpoints where all properties are required, the properties are enforced as method arguments to help prevent missing data. Please refer to API documentation to see what properties can be sent to which endpoint.

try {
    
    // Create Sendlane object
    $sendlane = new Sendlane('subdomain', 'key', 'hash');
    
    // Add subscriber to a list
    $result = $sendlane->user_details('test@test.com', 'password');
    
} catch (\Exception $e) {

    // Echo error message
    echo $e->getMessage();
}

General API information

Example API call (POST method for all calls)

https://SUBDOMAIN.sendlane.com/api/v1/METHOD?api=APIKEY&hash=HASHKEY

List of API Calls (POST method for all calls)

/api/v1/user-details
/api/v1/list-subscribers-add
/api/v1/list-subscriber-add
/api/v1/subscribers-delete
/api/v1/unsubscribe
/api/v1/list-create
/api/v1/list-update
/api/v1/list-delete
/api/v1/lists
/api/v1/opt-in-form
/api/v1/opt-in-create
/api/v1/subscriber-export
/api/v1/tags
/api/v1/tag-create
/api/v1/tag-subscriber-add
/api/v1/tag-subscriber-remove
/api/v1/subscriber-exists

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2019-06-14