for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Fanart.TV
* PHP class - wrapper for Fanart.TV's API
* API Documentation - http://docs.fanarttv.apiary.io/#.
*
* @author confact <[email protected]>
* @author DariusIII <[email protected]>
* @copyright 2013 confact
* @copyright 2017 NNTmux
* @date 2017-04-12
* @release <0.0.2>
*/
namespace Blacklight\libraries;
class FanartTV
{
* @var string
private $apiKey;
private $server;
* The constructor setting the config variables.
* @param $apiKey
public function __construct($apiKey)
$this->apiKey = $apiKey;
$this->server = 'https://webservice.fanart.tv/v3';
}
* Getting movie pictures.
* @param string $id
* @return array|false
public function getMovieFanArt($id)
if ($this->apiKey !== '') {
$fanArt = $this->_getUrl('movies/'.$id);
if (! empty($fanArt) && $fanArt['status'] !== 'error') {
return $fanArt;
return false;
* Getting tv show pictures.
public function getTVFanart($id)
$fanArt = $this->_getUrl('tv/'.$id);
* The function making all the work using curl to call.
* @param string $path
* @return false|array
private function _getUrl($path)
$url = $this->server.'/'.$path.'?api_key='.$this->apiKey;
$response = getRawHtml($url);
return $response !== false ? json_decode($response, true) : false;