项目作者: anime-db

项目描述 :
MyAnimeList.net API browser
高级语言: PHP
项目地址: git://github.com/anime-db/my-anime-list-browser-bundle.git
创建时间: 2017-07-19T15:35:00Z
项目社区:https://github.com/anime-db/my-anime-list-browser-bundle

开源协议:GNU General Public License v3.0

下载


MyAnimeList.com

Latest Stable Version
Total Downloads
Build Status
Coverage Status
Scrutinizer Code Quality
SensioLabs Insight
StyleCI
License

MyAnimeList.net API browser

Installation

Pretty simple with Composer, run:

  1. composer require anime-db/my-anime-list-browser-bundle

Add AnimeDbWorldArtBrowserBundle to your application kernel

  1. // app/appKernel.php
  2. public function registerBundles()
  3. {
  4. $bundles = array(
  5. // ...
  6. new AnimeDb\Bundle\MyAnimeListBrowserBundle\AnimeDbMyAnimeListBrowserBundle(),
  7. );
  8. }

Configuration

  1. anime_db_my_anime_list_browser:
  2. # Host name
  3. # As a default used 'http://myanimelist.net'
  4. host: 'http://myanimelist.net'
  5. # HTTP User-Agent
  6. # No default value
  7. client: 'My Custom Bot 1.0'

Usage

First get browser

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

Get info for anime Cowboy Bebop:

  1. $content = $browser->get('/anime/1');

Catch exceptions

  1. use AnimeDb\Bundle\MyAnimeListBrowserBundle\Exception\BannedException;
  2. use AnimeDb\Bundle\MyAnimeListBrowserBundle\Exception\NotFoundException;
  3. try {
  4. $content = $browser->get('/anime/1');
  5. } catch (BannedException $e) {
  6. // you are banned
  7. } catch (NotFoundException $e) {
  8. // page not found
  9. } catch (\Exception $e) {
  10. // other exceptions
  11. }

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