Read API documentation here: http://shikimori.org/api/doc
Pretty simple with Composer, run:
composer anime-db/shikimori-browser-bundle
anime_db_shikimori_browser:
# API host
# As a default used 'https://shikimori.org'
host: 'https://shikimori.org'
# Prefix for API resurces
# As a default used '/api/'
prefix: '/api/'
# HTTP User-Agent
# No default value
client: 'My Custom Bot 1.0'
First get browser
$browser = $this->get('anime_db.shikimori.browser');
List animes (docs)
$animes = $browser->get('animes', ['query' => ['limit' => 10]]);
or
$animes = $browser->get('animes?limit=10');
Mark all messages as read (docs)
$response = $browser->post('messages/read_all');
Update a message (docs)
$response = $browser->patch('messages/12', [
'body' => [
'message' => [
'body' => 'blablabla',
],
],
]);
Update a comment (docs)
$response = $browser->put('comments/8', [
'body' => [
'message' => [
'body' => 'blablabla',
],
],
]);
Destroy a message (docs)
$browser->delete('messages/12');
Catch exceptions
use AnimeDb\Bundle\ShikimoriBrowserBundle\Exception\NotFoundException;
try {
$content = $browser->get('animes/1');
} catch (NotFoundException $e) {
// anime not found
} catch (\Exception $e) {
// other exceptions
}
You can customize request options. See Guzzle Documentation.
This bundle is under the MIT license. See the complete license in the file: LICENSE