PHP code example of topi-k / misskeyauth

1. Go to this page and download the library: Download topi-k/misskeyauth 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/ */

    

topi-k / misskeyauth example snippets


use Topi\MisskeyAuth\MiAuth;

$mi = new MiAuth;
$mi->setInstance("misskey.example.com");
echo $mi->GenerateAuthURI("TestApp", "https://localhost/callback", ["write:notes"]);

use Topi\MisskeyAuth\MiAuth;

$mi = new MiAuth;
$mi->setUUID("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa");
echo $mi->getAccessToken();

use Topi\MisskeyAuth\MiAuth;

$auth = new MiAuth();
$auth->SetUserToken("TOKEN");
$auth->post("notes/create",["text" => "APIからテスト!", "visibility" => "followers"]);

use Topi\MisskeyAuth\MiAuth;

$auth = new MiAuth;
$auth->SetUserToken("TOKEN");

echo $auth->get("i",[]);