anime-db/anime-news-network-browser-bundle

v1.1.3 2017-08-13 19:09 UTC

This package is auto-updated.

Last update: 2024-11-15 20:13:17 UTC


README

AnimeNewsNetwork.com

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

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