PHP code example of cjrasmussen / mastodon-api

1. Go to this page and download the library: Download cjrasmussen/mastodon-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cjrasmussen / mastodon-api example snippets


use cjrasmussen\MastodonApi\MastodonApi;

$mastodon = new MastodonApi($server);

// SEND A TOOT WITH BEARER TOKEN
$mastodon->setBearerToken($bearer_token);
$response = $mastodon->request('POST', 'v1/statuses', ['status' => 'Toot text']);