Kirby3 Mastodon
This plugin provides access to your Mastodon statuses, called 'toots'.
Getting started
Use one of the following methods to install & use kirby3-mastodon
:
Git submodule
If you know your way around Git, you can download this plugin as a submodule:
git submodule add https://github.com/Fundevogel/kirby3-mastodon.git site/plugins/kirby3-mastodon
Composer
composer require fundevogel/kirby3-mastodon
Clone or download
Configuration
You may change certain options from your config.php
globally ('kirby3-mastodon.optionName'
):
Option | Type | Default | Description |
---|---|---|---|
'instance' |
string | mastodon.social |
Mastodon instance |
'client_key' |
string | '' |
Client key |
'client_secret' |
string | '' |
Client secret |
'access_token' |
string | '' |
Access token |
'app_name' |
string | 'Test App' |
Application name |
'app_url' |
string | '' |
Application URL |
'cache_duration' |
int | 'auto' |
Cache duration for toots (in minutes) |
'download_media' |
bool | 'weit' |
Whether images should be downloaded |
'template' |
string | mastodon.image |
File template for downloaded images |
Note: For starters, register an application (Edit profile > Development > New Application) & enter its fundevogel.mastodon.access_token
- otherwise, you'll only be granted application-level access.
Usage
There's a snippet to get you started:
# Timeline of currently active account
snippet('mastodon') ?>
# Timeline of a different account
snippet('mastodon', ['account' => '1234567890']) ?>
# Specific status (any account)
snippet('mastodon', ['id' => '1234567890']) ?>
It's pretty much a boilerplate to get you started - enjoy!
Methods
There are several ways to do this, you can either work with a php-mastodon
API object (via site method) or two page methods:
$site->mastodon(): \Fundevogel\Mastodon\Api
Site method: Grants access to a fully-enabled Api
instance (see here).
$page->toot(string $id): array
Page method: Get matching 'toot' for given $id
.
$page->toots(string $id = '')
Page method: Get last 20 'toots' of given account $id
(defaults to currently active account).
Roadmap
- Add tests
Credits / License
Mastodon is owned and operated by Eugen Rochko aka Gargron and his Mastodon gGmbH (german non-profit limited liability company). Thanks, Eugen!
kirby3-mastodon
is based on php-mastodon
library, both licensed under the GPL v3 License, but using Kirby in production requires you to buy a license.
Special Thanks
I'd like to thank everybody that's making great software - you people are awesome. Also I'm always thankful for feedback and bug reports :)