Moinax\TvDb\Client::setHttpClient PHP Method

setHttpClient() public method

Set the HttpClient used to query the API.
public setHttpClient ( Moinax\TvDb\Http\HttpClient $client )
$client Moinax\TvDb\Http\HttpClient
    public function setHttpClient(HttpClient $client)
    {
        $this->httpClient = $client;
    }

Usage Example

 /**
  * Register the application services.
  *
  * @return void
  */
 public function register()
 {
     app()->bind('TvDb', function () {
         $apiKey = env('TVDB_APIKEY', null);
         if (!$apiKey) {
             throw new \Exception('You need a TvDb API key.');
         }
         $cache = new FilesystemCache(storage_path() . '/TvDbCache');
         $ttl = 60 * 60 * 24;
         $httpClient = new CacheClient($cache, $ttl);
         $tvdb = new Client("http://thetvdb.com", $apiKey);
         $tvdb->setHttpClient($httpClient);
         $tvdb->setJsonDateFormat('d-m-Y');
         $tvdb->setDefaultLanguage('nl');
         return $tvdb;
     });
 }