This plugin provides access to your Mastodon statuses, called 'toots'.
Use one of the following methods to install & use kirby3-mastodon
:
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 require fundevogel/kirby3-mastodon
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.
There's a snippet to get you started:
# Timeline of currently active account
<?php snippet('mastodon') ?>
# Timeline of a different account
<?php snippet('mastodon', ['account' => '1234567890']) ?>
# Specific status (any account)
<?php snippet('mastodon', ['id' => '1234567890']) ?>
It's pretty much a boilerplate to get you started - enjoy!
There are several ways to do this, you can either work with a php-mastodon
API object (via site method) or two page methods:
Grants access to a fully-enabled Api
instance (see here).
Get matching 'toot' for given $id
.
Get last 20 'toots' of given account $id
(defaults to currently active account).
- Add tests
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.
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 :)