PHP code example of anime-db / ani-db-browser-bundle

1. Go to this page and download the library: Download anime-db/ani-db-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 / ani-db-browser-bundle example snippets


// app/appKernel.php

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

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

$content = $browser->get(['query' => ['request' => 'anime', 'aid' => 1]]);

use AnimeDb\Bundle\AniDbBrowserBundle\Exception\BannedException;
use AnimeDb\Bundle\AniDbBrowserBundle\Exception\NotFoundException;

try {
    $content = $browser->get('anime?aid=1');
} catch (BannedException $e) {
    // you are banned
} catch (NotFoundException $e) {
    // anime not found
} catch (\Exception $e) {
    // other exceptions
}