keinos / mastodon-streaming-api-config
Class that holds configuration info to use KEINOS\MSTDN_TOOLS classes.
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-10-23 12:36:11 UTC
README
Configuration Settings Class
This PHP class simply holds Mastodon server information from "instance" API method.
Use this class to get the URI of Mastodon Streaming API for receiving messages from server-sent events
or WebSocket
.
- Note: This class is aimed to be used in other Mastodon StreamingAPI tools.
Install
composer require keinos/mastodon-streaming-api-config
Usage
<?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();
If the server/instance is in WHITELIST_MODE
then you will need an access token to get the server information.
<?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();
- For other methods see the interface of the Config class.