Giter Club home page Giter Club logo

tvmaze-php-api-wrapper's Introduction

TVMaze-PHP-API-Wrapper

An easier way to interact with TVMaze's endpoints. Developed in PHP.

Installing VIA Composer

  • composer require joshpinkney/tv-maze-php-api dev-master

Goal

  • The goal of this API Wrapper is to turn TVMaze's endpoints into something more object orientated and readable
  • Provide a simple, open source project that anybody can contribute to

Supported Methods with full example below. Simple example found in Examples.php.

<?php

    require_once "TVMazeIncludes.php";

    $Client = new JPinkney\TVMaze\Client;
    
    /*
     * List of simple ways you can interact with the api
     */
     
    //Return all tv shows relating to the given input
    $Client->TVMaze->search("Arrow");
    
    //Return the most relevant tv show to the given input
    $Client->TVMaze->singleSearch("The Walking Dead");
    
    //Allows show lookup by using TVRage or TheTVDB ID
    $Client->TVMaze->getShowBySiteID("TVRage", 33272);

    //Return all possible actors relating to the given input
    $Client->TVMaze->getPersonByName("Nicolas Cage");
    
    //Return all the shows in the given country and/or date
    $Client->TVMaze->getSchedule();
    
    //Return all information about a show given the show ID
    $Client->TVMaze->getShowByShowID(1);
    
    //Return all episodes for a show given the show ID
    $Client->TVMaze->getEpisodesByShowID(1);
    
    //Return the cast for a show given the show ID
    $Client->TVMaze->getCastByShowID(1);
    
    //Return a master list of TVMazes shows given the page number
    $Client->TVMaze->getAllShowsByPage(2);
    
    //Return an actor given their ID
    $Client->TVMaze->getPersonByID(50);
    
    //Return an array of all the shows a particular actor has been in
    $Client->TVMaze->getCastCreditsByID(25);
    
    //Return an array of all the positions a particular actor has been in
    $Client->TVMaze->getCrewCreditsByID(100);
    
?>

Open Source Projects using this

tvmaze-php-api-wrapper's People

Contributors

dariusiii avatar jpinkney avatar niel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tvmaze-php-api-wrapper's Issues

php warning

I just tried out this api today and found that it would show the following warning each time:
Notice: A non well formed numeric value encountered in TVMaze/TVShow.php on line 138

Solved by changing line 138 from
$this->airTime = date("g:i A", $episode['airtime']);

to

$this->airTime = date("g:i A", strtotime($episode['airtime']));

PHP Warning: foreach() argument must be of type array|object, bool given

PHP Warning:  foreach() argument must be of type array|object, bool given in /var/www/REMOVED/vendor/joshpinkney/tv-maze-php-api/TVMaze/TVMaze.php on line 213

Been getting these for some TVMaze ID's that don't seem to exist, like 2817. TVMaze API returns a HTTP 404 and this JSON:

{
  "name": "Not Found",
  "message": "",
  "code": 0,
  "status": 404
}

Should be catchable.

Undefined array key "webChannel"

[2022-02-13 15:02:10] REMOVED.ERROR: Undefined array key "webChannel" {"exception":"[object] (ErrorException(code: 0): Undefined array key \"webChannel\" at /var/www/REMOVED/vendor/joshpinkney/tv-maze-php-api/TVMaze/TVShow.php:126)
[stacktrace]
#0 /var/www/REMOVED/vendor/joshpinkney/tv-maze-php-api/TVMaze/TVShow.php(126): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 /var/www/REMOVED/vendor/joshpinkney/tv-maze-php-api/TVMaze/TVMaze.php(73): JPinkney\\TVMaze\\TVShow->__construct()
#2 /var/www/REMOVED/removed/processing/tv/TVMaze.php(299): JPinkney\\TVMaze\\TVMaze->singleSearchAkas()
"}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.