anime-db / anime-news-network-browser-bundle
AnimeNewsNetwork.com API browser
v1.1.3
2017-08-13 19:09 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
README
AnimeNewsNetwork.com API browser
Encyclopedia API documentation you can see here.
Installation
Pretty simple with Composer, run:
composer require anime-db/anime-news-network-browser-bundle
Add AnimeDbAnimeNewsNetworkBrowserBundle to your application kernel
// app/appKernel.php public function registerBundles() { $bundles = array( // ... new AnimeDb\Bundle\AnimeNewsNetworkBrowserBundle\AnimeDbAnimeNewsNetworkBrowserBundle(), ); }
Configuration
anime_db_anime_news_network_browser: # Host name # As a default used 'https://cdn.animenewsnetwork.cc' host: 'https://cdn.animenewsnetwork.cc' # Reports # As a default used '/encyclopedia/reports.xml' reports: '/encyclopedia/reports.xml' # Anime/Manga Details # As a default used '/encyclopedia/api.xml' details: '/encyclopedia/api.xml' # HTTP User-Agent # No default value client: 'My Custom Bot 1.0'
Usage
First get browser
$browser = $this->get('anime_db.anime_news_network.browser');
Details
Detail info about anime Jinki:Extend.
$xml = $browser->details(['query' => ['anime' => 4658]]);
or
$xml = $browser->details(['query' => ['title' => 4658]]);
Detail info about manga Berserk.
$xml = $browser->details(['query' => ['manga' => 2298]]);
or
$xml = $browser->details(['query' => ['title' => 2298]]);
Reports
Anime/Manga list
$xml = $browser->reports(155);
People by Kanji name
$xml = $browser->reports(165, ['query' => ['nskip' => 20, 'nlist' => 10]]);
All reports you can see here.
Catch exceptions
use AnimeDb\Bundle\AnimeNewsNetworkBrowserBundle\Exception\NotFoundException; try { $content = $browser->details(['query' => ['anime' => 4658]]); } catch (NotFoundException $e) { // page not found } catch (\Exception $e) { // other exceptions }
Request options
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