websuckit/websuckit-php
最新稳定版本:v1.0.0
Composer 安装命令:
composer require websuckit/websuckit-php
包简介
Websuckit PHP library
README 文档
README
For tutorials and more in-depth information about websuckit Channels, visit our official docs.
Usage Overview
The following topics are covered:
Installation
Using composer
composer require websuckit/websuckit-php
Initialization
require_once 'vendor/autoload.php'; use Websuckit\WebsuckitPhp\Config; use Websuckit\WebsuckitPhp\Websuckit; $config = new Config($_ENV['USER_ID'], $_ENV['ACCESS_KEY'], $_ENV['PUBLIC_KEY']); $websuckit = new Websuckit($config);
You can get your USER_ID, ACCESS_KEY and PUBLIC_KEY from the websuckit dashboard.
Channel
Accessing a channel's websocket URL
It is possible to access a channel websocket URL by channel name, through the getConnectionUrl function
use Websuckit\WebsuckitPhp\Types\ChannelConnectionUrlConfig; $channel = new ChannelConnectionUrlConfig('CHANNEL-NAME', 'CHANNEL-PASS-KEY', false); $connection_url = $websuckit->getConnectionUrl($channel);
Create channel
$channel = $websuckit->createChannel('new-channel', 2);
Get channel
$channel = $websuckit->getChannel('CHANNEL-NAME');
Get channels (paginated)
$page = "0"; $per_page = "10"; //search variable that can be null $search = "search-term" $channels = $websuckit->getChannels($page, $per_page, $search);
Get or Create channel
$channel = $websuckit->getOrCreateChannel('CHANNEL-NAME');
Update channel
$channel = $websuckit->updateChannel('CHANNEL-ID', "CHANGE-CHANNEL-NAME", false, 2);
Delete channel
$websuckit->deleteChannel('CHANNEL-ID');
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-11-03