pushstream/pushstream-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pushstream/pushstream-php

最新稳定版本:v1.0.4

Composer 安装命令:

composer require pushstream/pushstream-php

包简介

PushStream PHP SDK for real-time messaging

README 文档

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_key
  • auth_timestamp
  • auth_version
  • body_md5
  • auth_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_SECRET server-side only.
  • This SDK is for trusted server environments, not browsers or mobile clients.

Testing

composer test

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固