pushstream / pushstream-php
PushStream PHP SDK for real-time messaging
v1.0.4
2026-02-18 07:29 UTC
Requires
- php: >=7.4
- ext-curl: *
- ext-json: *
README
Server-side PHP SDK for PushStream event publishing, batch publishing, channel auth payload generation, and webhook signature verification.
Installation
composer require pushstream/pushstream-php
Configuration
Pass apiUrl explicitly or set PUSHSTREAM_API_URL.
use PushStream\PushStream; $client = new PushStream( 'APP_ID', 'APP_KEY', 'APP_SECRET', ['apiUrl' => 'https://api.pushstream.online'] );
Publish
$response = $client->publish('public-orders', 'order.created', ['id' => 1]);
The SDK signs requests with the current PushStream query contract:
auth_keyauth_timestampauth_versionbody_md5auth_signature
Batch Publish
$client->publishBatch([ ['name' => 'order.created', 'channel' => 'public-orders', 'data' => ['id' => 1]], ['name' => 'order.updated', 'channel' => 'public-orders', 'data' => ['id' => 1, 'status' => 'paid']], ]);
Channel Auth
$auth = $client->authorizeChannel( '123.456', 'presence-org-1-chat', ['user_id' => '1001', 'user_info' => ['name' => 'Kamal']] );
Returned payload shape:
auth=>{app_key}:{signature}channel_data=> JSON string for presence channels
Webhook Verification
$valid = $client->verifyWebhook($signature, $rawBody);
Security Notes
- Keep
APP_SECRETserver-side only. - This SDK is for trusted server environments, not browsers or mobile clients.
Testing
composer test