platform5/sdk
Composer 安装命令:
composer require platform5/sdk
包简介
PHP SDK for the Platform5 Developer API — send SMS, email, and more
README 文档
README
PHP SDK for the Platform5 Developer API.
Install
composer require platform5/sdk
Usage
<?php require 'vendor/autoload.php'; use Platform5\Sdk\Platform5; $client = new Platform5('p5_live_abc123def456', 'http://localhost:8084'); // Send an SMS $sms = $client->sms()->send([ 'to' => '+254712345678', 'message' => 'Your appointment is confirmed for tomorrow at 10 AM.', 'from' => 'MyBrand', ]); echo $sms['message_id']; // Send an email $client->email()->send([ 'to' => 'user@example.com', 'subject' => 'Welcome', 'body' => 'Hello!', 'from' => 'MyBrand', ]); // Check message status $status = $client->messages()->get('msg-uuid'); // Check balance $balance = $client->account()->getBalance();
Configuration
new Platform5( apiKey: 'p5_live_abc123', baseUrl: 'http://localhost:8084', // optional );
Services
| Method | Endpoint |
|---|---|
$client->sms()->send([...]) |
POST /v1/sms/send |
$client->email()->send([...]) |
POST /v1/email/send |
$client->messages()->get($id) |
GET /v1/messages/{id} |
$client->account()->getBalance() |
GET /v1/balance |
$client->health() |
GET /health |
Error Handling
use Platform5\Sdk\Exception\RateLimitException; use Platform5\Sdk\Exception\Platform5Exception; try { $client->sms()->send([...]); } catch (RateLimitException $e) { echo "Rate limited: {$e->remaining}/{$e->limit}"; } catch (Platform5Exception $e) { echo "API error {$e->statusCode}: {$e->getMessage()}"; }
Requirements
- PHP 8.2+
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-14