keinos / mastodon-streaming-api-config
用于存储使用 KEINOS\MSTDN_TOOLS 类配置信息的类。
1.0.1
2020-07-22 16:56 UTC
Requires
- php: ^8.0 || ^7.1
- ext-mbstring: *
- keinos/mastodon-streaming-api-cache: ^1.0.0-RC1
- symfony/http-client: ^4.4
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.3
- phan/phan: ^2.5
- php-coveralls/php-coveralls: ^2.2
- phpbench/phpbench: @dev
- phpmd/phpmd: @stable
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: ^0.12.10
- phpunit/phpunit: ^9.0 || ^8.0 || ^7.0 || ^6.5
- psalm/phar: ^3.9
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-09-23 12:25:30 UTC
README
配置设置类
这个 PHP 类简单地存储来自 "instance" API 方法 的 Mastodon 服务器信息。
使用此类获取接收来自 server-sent events
或 WebSocket
的消息的 Mastodon Streaming API 的 URI。
- 注意:此类旨在用于其他 Mastodon StreamingAPI 工具。
安装
composer require keinos/mastodon-streaming-api-config
用法
<?php namespace KEINOS\Sample; require_once __DIR__ . '/../vendor/autoload.php'; $conf = new \KEINOS\MSTDN_TOOLS\Config\Config([ 'url_host' => 'https://qiitadon.com/', // Your server/instance URL ]); $info_instance = $conf->getInfoInstance(); $uri_websocket = $conf->getUriStreamingApi();
如果服务器/实例处于 WHITELIST_MODE
,则您需要访问令牌才能获取服务器信息。
<?php namespace KEINOS\Sample; require_once __DIR__ . '/../vendor/autoload.php'; use KEINOS\MSTDN_TOOLS\Config\Config; $conf = new Config([ 'url_host' => 'https://qiitadon.com/', 'access_token' => 'YOUR ACCESS TOKEN HERE', ]); $info_instance = $conf->getInfoInstance(); $uri_websocket = $conf->getUriStreamingApi(); $access_token = $cong->getAccessToken();
- 有关其他方法,请参阅 Config 类的接口。