braze/sdk
最新稳定版本:3.0.0
Composer 安装命令:
composer require braze/sdk
包简介
Track users, send messages, export data, and more with Braze API.
README 文档
README
PHP library for Braze. The code is generated from the OpenAPI spec.
Note
Disclaimer: This is a community-maintained project and is not officially endorsed by or affiliated with Braze, Inc.
Requirements
Version
PHP >=8.1
API URL
Use the REST endpoint provisioned to your account when you log in to the dashboard:
| Instance | REST Endpoint |
|---|---|
| US-01 | https://rest.iad-01.braze.com |
| US-02 | https://rest.iad-02.braze.com |
| US-03 | https://rest.iad-03.braze.com |
| US-04 | https://rest.iad-04.braze.com |
| US-05 | https://rest.iad-05.braze.com |
| US-06 | https://rest.iad-06.braze.com |
| US-08 | https://rest.iad-08.braze.com |
| EU-01 | https://rest.fra-01.braze.eu |
| EU-02 | https://rest.fra-02.braze.eu |
API Key
The API key can be created in your Braze dashboard.
Install
Install the package with Composer:
composer require braze/sdk
If you're missing a package providing psr/http-client-implementation:
composer require php-http/guzzle7-adapter
Add autoloading:
require_once 'vendor/autoload.php';
Usage
Instantiate the SDK:
use Braze\Braze; $braze = new Braze('YOUR_API_URL', 'YOUR_API_KEY'); $client = $braze->client;
Send a message to your user:
use Braze\Braze; use Braze\Model\MessagesSendPostBody; use Braze\Model\MessagesSendPostBodyMessages; $braze = new Braze('YOUR_API_URL', 'YOUR_API_KEY'); $body = new MessagesSendPostBody(); $body->setExternalUserIds(['your_external_user_id']); $messages = new MessagesSendPostBodyMessages(); $messages->setEmail([ 'app_id' => 'your_app_id', 'from' => 'Company <company@example.com>', 'email_template_id' => 'your_email_template_id', ]); $body->setMessages($messages); $response = $braze->client->postMessagesSend($body)->getBody();
Handle an API error:
use Braze\Braze; $braze = new Braze('YOUR_API_URL', 'YOUR_API_KEY'); try { $response = $braze->client->getCatalog()->getBody(); } catch (Throwable $exception) { echo $exception->getMessage(); echo $exception->getCode(); }
Scripts
composer build
Generate the code:
composer build
composer clean
Delete the lib/ directory:
composer clean
composer test
Run the tests:
composer test
About This Package
This package is automatically generated by Jane.
License
Braze is a registered trademark of Braze, Inc. This project is not managed by Braze, Inc.
统计信息
- 总下载量: 161.29k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-08-13