PHP SDK
Official Splashify Pro SDK for PHP. Built on Guzzle for HTTP, fully PSR-4 autoloaded, framework-agnostic.
Package: splashifypro/sdk
Install
composer require splashifypro/sdkRequires PHP 8.1+ + ext-curl + ext-json.
Configure
use Splashifypro\Splashify;
$splashify = new Splashify([
'api_key' => getenv('SPLASHIFY_API_KEY'),
// optional:
'base_url' => 'https://apis.splashifypro.com',
'timeout' => 30, // seconds
'retries' => 3, // 5xx auto-retry with backoff
]);First message — under 10 lines
<?php
require 'vendor/autoload.php';
use Splashifypro\Splashify;
$splashify = new Splashify(['api_key' => getenv('SPLASHIFY_API_KEY')]);
$result = $splashify->messages->sendText([
'to' => '919876543210',
'text' => 'Hello from Splashify Pro!',
]);
echo "Sent: {$result->messageId}\n";Common patterns
Send a template
$splashify->messages->sendTemplate([
'to' => '919876543210',
'templateName' => 'order_confirmation',
'language' => 'en',
'bodyParameters' => ['Aditya', '#1234', '₹2,499'],
]);Send media
$splashify->messages->sendMedia([
'to' => '919876543210',
'type' => 'image',
'mediaUrl' => 'https://your-cdn.com/photo.jpg',
'caption' => 'Check this out!',
]);Create a broadcast
$broadcast = $splashify->broadcasts->create([
'name' => 'Diwali sale',
'templateName' => 'diwali_offer_v1',
'language' => 'en',
'audienceType' => 'segments',
'segmentIds' => ['<segment-uuid>'],
]);
echo "Broadcast {$broadcast->id} queued\n";
$report = $splashify->broadcasts->report($broadcast->id);
echo "{$report->sent}/{$report->total} sent\n";List contacts with pagination
$cursor = null;
do {
$page = $splashify->contacts->list(['limit' => 100, 'cursor' => $cursor]);
foreach ($page->edges as $c) {
echo "{$c->phone}\t{$c->name}\n";
}
$cursor = $page->pageInfo->hasNextPage ? $page->pageInfo->endCursor : null;
} while ($cursor !== null);Verify a webhook (Laravel)
use Splashifypro\Webhooks;
Route::post('/splashify/webhook', function (Request $request) {
if (!Webhooks::verify(
rawBody: $request->getContent(),
signature: $request->header('X-Splashify-Signature', ''),
secret: env('SPLASHIFY_WEBHOOK_SECRET'),
)) {
return response('', 401);
}
$event = $request->json()->all();
Log::info("Splashify event: {$event['type']}", $event['payload']);
return response('', 200);
});Verify a webhook (vanilla PHP)
$rawBody = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_SPLASHIFY_SIGNATURE'] ?? '';
if (!Splashifypro\Webhooks::verify(
rawBody: $rawBody,
signature: $signature,
secret: getenv('SPLASHIFY_WEBHOOK_SECRET'),
)) {
http_response_code(401);
exit;
}
$event = json_decode($rawBody, true);
// Process $event['type'] + $event['payload']
http_response_code(200);Error handling
use Splashifypro\Exceptions\{
SplashifyException,
RateLimitException,
AuthException,
ValidationException,
NotFoundException,
};
try {
$splashify->messages->sendText(['to' => '919876543210', 'text' => 'Hi']);
} catch (RateLimitException $e) {
echo "Rate limited, retry after {$e->retryAfterSec}s\n";
} catch (AuthException $e) {
echo "Bad API key\n";
} catch (ValidationException $e) {
echo "Bad input: {$e->field} — {$e->reason}\n";
} catch (SplashifyException $e) {
echo "API error {$e->code}: {$e->getMessage()}\n";
}PHPDoc + IDE autocomplete
Every method has full PHPDoc — works with PHPStorm, VS Code + Intelephense, Vim + intelephense LSP.
Source + issues
- Packagist: https://packagist.org/packages/splashifypro/sdk
- GitHub: https://github.com/splashifypro/sdk-php
- Issues: file at the GitHub repo above