PHP code example of anime-db / shikimori-browser-bundle

1. Go to this page and download the library: Download anime-db/shikimori-browser-bundle 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/ */

    

anime-db / shikimori-browser-bundle example snippets


$browser = $this->get('anime_db.shikimori.browser');

$animes = $browser->get('animes', ['query' => ['limit' => 10]]);

$animes = $browser->get('animes?limit=10');

$response = $browser->post('messages/read_all');

$response = $browser->patch('messages/12', [
    'body' => [
        'message' => [
            'body' => 'blablabla',
        ],
    ],
]);

$response = $browser->put('comments/8', [
    'body' => [
        'message' => [
            'body' => 'blablabla',
        ],
    ],
]);

$browser->delete('messages/12');

use AnimeDb\Bundle\ShikimoriBrowserBundle\Exception\NotFoundException;

try {
    $content = $browser->get('animes/1');
} catch (NotFoundException $e) {
    // anime not found
} catch (\Exception $e) {
    // other exceptions
}