anime-db / shikimori-browser-bundle
Plugin Shikimori for the catalog Anime DB
Installs: 1 483
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- php: >=5.5
- guzzlehttp/guzzle: ~6.3
Requires (Dev)
- phpunit/phpunit: ~4.8
- satooshi/php-coveralls: ^1.0
- scrutinizer/ocular: ~1.3
- symfony/config: ~2.7|~3.0
- symfony/dependency-injection: ~2.7|~3.0
- symfony/expression-language: ~2.7|~3.0
- symfony/http-kernel: ~2.7|~3.0
README
Shikimori.org API browser
Read API documentation here: http://shikimori.org/api/doc
Installation
Pretty simple with Composer, run:
composer anime-db/shikimori-browser-bundle
Configuration
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'
Usage
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.
License
This bundle is under the MIT license. See the complete license in the file: LICENSE