1. Go to this page and download the library: Download yangusik/shikimori-api-php 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/ */
yangusik / shikimori-api-php example snippets
$session = new ShikimoriAPI\Session(
'CLIENT_ID',
'CLIENT_SECRET',
'REDIRECT_URI'
);
$api = new ShikimoriAPI\ShikimoriAPI(['auto_refresh' => false]);
if (isset($_GET['code'])) {
$session->requestAccessToken($_GET['code']);
// use session to make auto-refresh token auto_refresh = true
$api->setSession($session);
// or just a token if you don't need auto-refresh token
$api->setAccessToken($session->getAccessToken());
print_r($api->whoami());
} else {
$options = [
'scope' => [
'user-read-email',
],
];
header('Location: ' . $session->getAuthorizeUrl($options));
die();
}