PHP SDK for the Platform5 Developer API — send SMS, email, and more

Maintainers

Package info

github.com/nixoncode/platform5-sdk-php

pkg:composer/platform5/sdk

Transparency log

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-07-14 08:22 UTC

This package is auto-updated.

Last update: 2026-07-14 08:25:33 UTC


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+