PHP Classes

PHP YouTube Movie Trailers 2018, 2017, 2016 or Any Year: Fetch and show YouTube movie trailers

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 324 All time: 7,202 This week: 524Up
Version License PHP version Categories
youtube-trailers 1.0.1GNU General Publi...7Web services, Video, PHP 7
Description 

Author

This package can fetch and show YouTube movie trailers without an API key.

It can send an HTTP requests to the YouTube site to retrieve and parse the YouTube search result pages for a trailer of a given movie.

Since it can search by year you may retrieve the list of trailers of 2018, 2017, 2016 or any other year you prefer.

The class extracts the identifier of the first result video and generates HTML to embed that video in a Web page.

Picture of Nitesh Apte
  Performance   Level  
Name: Nitesh Apte <contact>
Classes: 18 packages by
Country: India India
Innovation award
Innovation award
Nominee: 3x

Winner: 1x

Example

<?php
use YouTubeTrailer\Bean\Movie;
use
YouTubeTrailer\Core\YouTubeTrailer;
use
YouTubeTrailer\Bean\Trailer;

include_once
'autoload.php';

$movieBean = new Movie();
$movieBean->setMovieName($_GET['movie']);
$movieBean->setYearOfRelease($_GET['year']);
$movieBean->setLanguage($_GET['language']);

$trailerObj = new YouTubeTrailer();
$trailerBean = $trailerObj->getTrailerByNameAndYear($movieBean);

$id = $trailerBean->getId();
$type = $trailerBean->getContentType();
$width = $trailerBean->getWidth();
$height = $trailerBean->getHeight();
$video = $trailerBean->getMatch();
$param = $trailerBean->getParameterString();
$frame = $trailerBean->getFrameBody();
$fullscreen = $trailerBean->getAllowFullScreen();

$trailer = "<iframe id='$id' type='$type' width='$width' height='$height' src='https://www.youtube.com/embed/$video?$param' frameborder='$frame' allowfullscreen='$fullscreen'></iframe>";

echo
$trailer;


Details

YouTube Trailer 2.0

Fetch trailer from YouTube without API Key


  Files folder image Files (28)  
File Role Description
Files folder imagejscript (1 file, 1 directory)
Files folder imagelib (1 directory)
Accessible without login Plain text file autoload.php Aux. Autoload classes
Accessible without login Plain text file index.php Aux. Start app
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Readme
Accessible without login Plain text file trailer.php Example Usage

  Files folder image Files (28)  /  jscript  
File Role Description
Files folder imagefancybox (17 files)
  Accessible without login Plain text file jquery.js Data script

  Files folder image Files (28)  /  jscript  /  fancybox  
File Role Description
  Accessible without login Image file fancy_closebox.png Icon image
  Accessible without login Image file fancy_left.png Icon image
  Accessible without login Image file fancy_progress.png Icon image
  Accessible without login Image file fancy_right.png Icon image
  Accessible without login Image file fancy_shadow_e.png Icon image
  Accessible without login Image file fancy_shadow_n.png Icon image
  Accessible without login Image file fancy_shadow_ne.png Icon image
  Accessible without login Image file fancy_shadow_nw.png Icon image
  Accessible without login Image file fancy_shadow_s.png Icon image
  Accessible without login Image file fancy_shadow_se.png Icon image
  Accessible without login Image file fancy_shadow_sw.png Icon image
  Accessible without login Image file fancy_shadow_w.png Icon image
  Accessible without login Image file fancy_title_left.png Icon image
  Accessible without login Image file fancy_title_main.png Icon image
  Accessible without login Image file fancy_title_right.png Icon image
  Accessible without login Plain text file jquery.fancybox-1.2.6.css Data image
  Accessible without login Plain text file jquery.fancybox-1.2.6.js Data image

  Files folder image Files (28)  /  lib  
File Role Description
Files folder imageyoutubetrailer (4 directories)

  Files folder image Files (28)  /  lib  /  youtubetrailer  
File Role Description
Files folder imagebean (2 files)
Files folder imagecore (1 file)
Files folder imageexception (1 file)
Files folder imagehelper (1 file)

  Files folder image Files (28)  /  lib  /  youtubetrailer  /  bean  
File Role Description
  Plain text file Movie.php Class Movie bean
  Plain text file Trailer.php Class Trailer bean

  Files folder image Files (28)  /  lib  /  youtubetrailer  /  core  
File Role Description
  Plain text file YouTubeTrailer.php Class Main class

  Files folder image Files (28)  /  lib  /  youtubetrailer  /  exception  
File Role Description
  Plain text file YouTubeException.php Class Exception class

  Files folder image Files (28)  /  lib  /  youtubetrailer  /  helper  
File Role Description
  Plain text file YouTubeTrailerHelper.php Class Main helper class to set values

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:324
This week:0
All time:7,202
This week:524Up