digs/courier-sdk-php
最新稳定版本:v0.10
Composer 安装命令:
composer require digs/courier-sdk-php
包简介
PHP implementation of Courier's API as an SDK. With additional support for Laravel 5.8+
README 文档
README
Courier PHP SDK supporting:
- Send API
- Messages API
- Profiles API
- Preferences API
Official Courier API docs
For a full description of request and response payloads and properties, please see the official Courier API docs.
Requirements
- PHP 7.2+
- ext-curl
- ext-json
Installation
composer require digs/courier-sdk-php
Configuration
Instantiate the Courier client class with your authorization and (optional) username. Providing just a authorization token will generate a "Bearer" authorization header, while providing a username will generate a "Basic" (base64-encoded) authorization header
$client = new Courier("authorization-token", "username");
Options
Many methods allow the passing of optional data to the Courier endoint. This data should be an associative array of key/value pairs. The exact options supported are dependent on the endpoint being called. Please refer to the official Courier documentation for more information.
$profile = [ "firstname" => "Johnny", "lastname" => "Appleseed", "email" => "johnny.appleseed@mail.com" ];
Methods
For a full description of request and response payloads and properties, please see the official Courier API docs.
Send API
sendNotification(string $event, string $recipient, array $profile = [], array $data = [], array $preferences = [], array $overrides = []): object[?]
Messages API
getMessage(string $message_id): object[?]
Profiles API
getProfile(string $recipient_id): object[?]upsertProfile(string $recipient_id, array $profile_attributes): object[?]replaceProfile(string $recipient_id, array $profile_attributes): object[?]patchProfile(string $recipient_id, array $patch): object[?]
Preferences API
getPreferences(string $recipient_id, string $preferred_channel): object[?]updatePreferences(string $recipient_id, string $preferred_channel): object[?]
Errors
All unsuccessfull (non 2xx) responses will throw a CourierRequestException. The full response object is available via the getResponse() method.
统计信息
- 总下载量: 1.72M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-03-01