PHP code example of rdrenth / tvrage-bundle

1. Go to this page and download the library: Download rdrenth/tvrage-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/ */

    

rdrenth / tvrage-bundle example snippets




// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(),
        // ...
        new Rdrenth\TvrageBundle\RdrenthTvrageBundle(),
        // ...
    );
}



// src/AppBundle/Controller/DefaultController.php

namespace AppBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class DefaultController extends Controller
{
    public function searchAction(Request $request)
    {
        $tvrageClient = $this->get('rdrenth_tvrage.client');
        $shows = array();
        
        try {
            $response = $tvrageClient->search($request->get('query', 'Breaking Bad'));
            $shows = $response->getShows();
        } catch (\Exception $e) {
        
        }
        
        return $this->render('default/search.html.twig', array('shows' => $shows));
    }
}