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   View files Example   View files View files (28)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 324 All time: 7,192 This week: 131Up
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 is available for providing paid consulting. Contact Nitesh Apte .
Classes: 17 packages by
Country: India India
Age: 40
All time rank: 1337 in India India
Week rank: 45 Up6 in India India Up
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  
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  /  jscript  
File Role Description
Files folder imagefancybox (17 files)
  Accessible without login Plain text file jquery.js Data script

  Files folder image Files  /  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  /  lib  
File Role Description
Files folder imageyoutubetrailer (4 directories)

  Files folder image Files  /  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  /  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  /  lib  /  youtubetrailer  /  core  
File Role Description
  Plain text file YouTubeTrailer.php Class Main class

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

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

 Version Control Unique User Downloads Download Rankings  
 100%
Total:324
This week:0
All time:7,192
This week:131Up