camcima/pubnub-php-api
Composer 安装命令:
composer require camcima/pubnub-php-api
包简介
Composer port of PubNub PHP API
README 文档
README
###YOU MUST HAVE A PUBNUB ACCOUNT TO USE THE API. ###http://www.pubnub.com/account
PubNub 3.3 Real-time Cloud Push API - PHP
www.pubnub.com - PubNub Real-time Push Service in the Cloud. http://www.pubnub.com/blog/php-push-api-walkthrough
PubNub is a Massively Scalable Real-time Service for Web and Mobile Games.
This is a cloud-based service for broadcasting Real-time messages
to thousands of web and mobile clients simultaneously.
PHP Push API
$pubnub = new Pubnub( "demo", ## PUBLISH_KEY "demo", ## SUBSCRIBE_KEY "", ## SECRET_KEY false ## SSL_ON? );
Send Message (PUBLISH)
$info = $pubnub->publish(array( 'channel' => 'hello_world', ## REQUIRED Channel to Send 'message' => 'Hey World!' ## REQUIRED Message String/Array )); print_r($info);
Request Messages (HISTORY, deprecated, use detailedHistory() below)
$messages = $pubnub->history(array( 'channel' => 'hello_world', ## REQUIRED Channel to Send 'limit' => 100 ## OPTIONAL Limit Number of Messages )); print_r($messages); ## Prints array of messages.
Request Server Time (TIME)
$timestamp = $pubnub->time(); var_dump($timestamp); ## Prints integer timestamp.
Receive Message (SUBSCRIBE) PHP 5.2.0
$pubnub->subscribe(array( 'channel' => 'hello_world', ## REQUIRED Channel to Listen 'callback' => create_function( ## REQUIRED PHP 5.2.0 Method '$message', 'var_dump($message); return true;' ) ));
Receive Message (SUBSCRIBE) PHP 5.3.0
$pubnub->subscribe(array( 'channel' => 'hello_world', ## REQUIRED Channel to Listen 'callback' => function($message) { ## REQUIRED Callback With Response var_dump($message); ## Print Message return true; ## Keep listening (return false to stop) } ));
Realtime Join/Leave Events (Presence)
$pubnub->presence(array( 'channel' => $channel, 'callback' => function($message) { print_r($message); echo "\r\n"; return true; } ));
On-demand Occupancy Status (here_now)
$here_now = $pubnub->here_now(array( 'channel' => $channel ));
Detailed History (detailedHistory())
$history = $pubnub->detailedHistory(array( 'channel' => $channel, 'count' => 10, 'end' => "13466530169226760" ));
camcima/pubnub-php-api 适用场景与选型建议
camcima/pubnub-php-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.96k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2012 年 11 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「websocket」 「composer」 「messaging」 「realtime」 「pubnub」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 camcima/pubnub-php-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 camcima/pubnub-php-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 camcima/pubnub-php-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This composer plugin enables installation of GravityForms WordPress plugin and its addons.
Simple ASCII output of array data
WebSocket view engine
Alfabank REST API integration
Generate a Composer repository from installed WordPress plugins and themes.
统计信息
- 总下载量: 9.96k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2012-11-12