anime-db / my-anime-list-browser-bundle
MyAnimeList.net API browser
v1.1.1
2017-08-20 21:05 UTC
Requires
- php: >=5.5
- guzzlehttp/guzzle: ~6.2
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
This package is auto-updated.
Last update: 2024-12-15 19:55:59 UTC
README
MyAnimeList.net API browser
Installation
Pretty simple with Composer, run:
composer require anime-db/my-anime-list-browser-bundle
Add AnimeDbWorldArtBrowserBundle to your application kernel
// app/appKernel.php public function registerBundles() { $bundles = array( // ... new AnimeDb\Bundle\MyAnimeListBrowserBundle\AnimeDbMyAnimeListBrowserBundle(), ); }
Configuration
anime_db_my_anime_list_browser: # Host name # As a default used 'http://myanimelist.net' host: 'http://myanimelist.net' # HTTP User-Agent # No default value client: 'My Custom Bot 1.0'
Usage
First get browser
$browser = $this->get('anime_db.my_anime_list.browser');
Get info for anime Cowboy Bebop:
$content = $browser->get('/anime/1');
Catch exceptions
use AnimeDb\Bundle\MyAnimeListBrowserBundle\Exception\BannedException; use AnimeDb\Bundle\MyAnimeListBrowserBundle\Exception\NotFoundException; try { $content = $browser->get('/anime/1'); } catch (BannedException $e) { // you are banned } catch (NotFoundException $e) { // page not found } catch (\Exception $e) { // other exceptions }
You can customize request options. See Guzzle Documentation.
License
This bundle is under the GPL v3 license. See the complete license in the file: LICENSE