PHP code example of anime-db / anime-news-network-browser-bundle

1. Go to this page and download the library: Download anime-db/anime-news-network-browser-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

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


// app/appKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new AnimeDb\Bundle\AnimeNewsNetworkBrowserBundle\AnimeDbAnimeNewsNetworkBrowserBundle(),
    );
}

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

$xml = $browser->details(['query' => ['anime' => 4658]]);

$xml = $browser->details(['query' => ['title' => 4658]]);

$xml = $browser->details(['query' => ['manga' => 2298]]);

$xml = $browser->details(['query' => ['title' => 2298]]);

$xml = $browser->reports(155);

$xml = $browser->reports(165, ['query' => ['nskip' => 20, 'nlist' => 10]]);

use AnimeDb\Bundle\AnimeNewsNetworkBrowserBundle\Exception\NotFoundException;

try {
    $content = $browser->details(['query' => ['anime' => 4658]]);
} catch (NotFoundException $e) {
    // page not found
} catch (\Exception $e) {
    // other exceptions
}