All Projects → ricardofiorani → php-video-url-parser

ricardofiorani / php-video-url-parser

Licence: MIT License
A Simple and efficient PHP Video URL Parser that provides you thumbnails and embed codes for various video streaming websites

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to php-video-url-parser

oembed
PHP OEmbed wrapper for well-known video platforms and services
Stars: ✭ 26 (-54.39%)
Mutual labels:  vimeo, thumbnails, embed, dailymotion, video-embed
Vime
Customizable, extensible, accessible and framework agnostic media player. Modern alternative to Video.js and Plyr. Supports HTML5, HLS, Dash, YouTube, Vimeo, Dailymotion...
Stars: ✭ 1,928 (+3282.46%)
Mutual labels:  youtube, vimeo, embed, dailymotion
Lightgallery
A customizable, modular, responsive, lightbox gallery plugin.
Stars: ✭ 4,829 (+8371.93%)
Mutual labels:  youtube, vimeo, thumbnails
Lightgallery.js
Full featured JavaScript image & video gallery. No dependencies
Stars: ✭ 5,168 (+8966.67%)
Mutual labels:  youtube, vimeo, thumbnails
Alltube
Web GUI for youtube-dl
Stars: ✭ 1,925 (+3277.19%)
Mutual labels:  youtube, vimeo, dailymotion
React Player
A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia and DailyMotion
Stars: ✭ 5,931 (+10305.26%)
Mutual labels:  youtube, vimeo, dailymotion
Modal Video
Stars: ✭ 224 (+292.98%)
Mutual labels:  youtube, vimeo
Lazyframe
🛀🏽 Dependency-free library for lazyloading iframes
Stars: ✭ 237 (+315.79%)
Mutual labels:  youtube, vimeo
React Plyr
📺 A React video component based on Plyr
Stars: ✭ 254 (+345.61%)
Mutual labels:  youtube, vimeo
video-to-markdown
How to embed a video in markdown? Here the answer. Add videos to your markdown files easier.
Stars: ✭ 159 (+178.95%)
Mutual labels:  vimeo, dailymotion
MementoEmbed
A service that provides archive-aware oEmbed-compatible embeddable surrogates (social cards, thumbnails, etc.) for archived web pages (mementos).
Stars: ✭ 13 (-77.19%)
Mutual labels:  thumbnails, embed
youtube rss
A YouTube-client for managing subscriptions and watching videos anonymously over Tor without a Google account.
Stars: ✭ 49 (-14.04%)
Mutual labels:  youtube, thumbnails
Min Vid
Popout video player in Firefox
Stars: ✭ 180 (+215.79%)
Mutual labels:  youtube, vimeo
Workflowshare
Workflow实例分享
Stars: ✭ 137 (+140.35%)
Mutual labels:  youtube, vimeo
Gatsby Remark Embedder
Gatsby Remark plugin to embed well known services by their URL.
Stars: ✭ 245 (+329.82%)
Mutual labels:  youtube, embed
vlitejs
🦋 vLitejs is a fast and lightweight Javascript library for customizing video and audio player in Javascript with a minimalist theme (HTML5, Youtube, Vimeo, Dailymotion)
Stars: ✭ 162 (+184.21%)
Mutual labels:  vimeo, dailymotion
ngx-embed-video
Get embed code for embedding youtube/vimeo/dailymotion/* video in websites from URL or ID in Angular 6+.
Stars: ✭ 58 (+1.75%)
Mutual labels:  vimeo, dailymotion
ckeditor-youtube-plugin
CKEditor Plugin to embed Youtube videos.
Stars: ✭ 53 (-7.02%)
Mutual labels:  embed, video-url
laravel-video-api
Laravel (Youtube/Vimeo) Video Data API
Stars: ✭ 53 (-7.02%)
Mutual labels:  youtube, vimeo
Socialcounters
jQuery/PHP - Collection of Social Media APIs that display number of your social media fans. Facebook Likes, Twitter Followers, Instagram Followers, YouTube Subscribers, etc..
Stars: ✭ 104 (+82.46%)
Mutual labels:  youtube, vimeo

DEPRECATED !

If you have PHP 7.4 or newer then please use https://github.com/ricardofiorani/oembed instead.
This lib will receive only small bugfixes, not new features anymore.

PHP Video URL Parser

Build Status Minimum PHP Version License Total Downloads Coding Standards Scrutinizer Code Quality Code Coverage

PHP Video URL Parser is a parser that detects a given video url and returns an object containing information like the video's embed code, title, description, thumbnail and other information that the service's API may give.

Installation

Install the latest version with

$ composer require ricardofiorani/php-video-url-parser

Requirements

  • PHP 5.3
  • cURL (Or at least file_get_contents() enabled if you want to use it with Vimeo, otherwise it's not required)

Basic Usage

<?php
use RicardoFiorani\Matcher\VideoServiceMatcher;

require __DIR__ . '/vendor/autoload.php';

$vsm = new VideoServiceMatcher();

//Detects which service the url belongs to and returns the service's implementation
//of RicardoFiorani\Adapter\VideoAdapterInterface
$video = $vsm->parse('https://www.youtube.com/watch?v=PkOcm_XaWrw');

//Checks if service provides embeddable videos (most services does)
if ($video->isEmbeddable()) {
    //Will echo the embed html element with the size 200x200
    echo $video->getEmbedCode(200, 200);

    //Returns the embed html element with the size 1920x1080 and autoplay enabled
    echo $video->getEmbedCode(1920, 1080, true);
    
    //Returns the embed html element with the size 1920x1080, autoplay enabled and force the URL schema to be https.
    echo $video->getEmbedCode(1920, 1080, true, true);
}

//If you don't want to check if service provides embeddable videos you can try/catch
try {
    echo $video->getEmbedUrl();
} catch (\RicardoFiorani\Exception\NotEmbeddableException $e) {
    die(sprintf("The URL %s service does not provide embeddable videos.", $video->getRawUrl()));
}

//Gets URL of the smallest thumbnail size available
echo $video->getSmallThumbnail();

//Gets URL of the largest thumbnail size available
//Note some services (such as Youtube) does not provide the largest thumbnail for some low quality videos (like the one used in this example)
echo $video->getLargestThumbnail();

Registering your own service video (it's easy !)

If you want to register an implementation of some service your class just needs to implement the "RicardoFiorani\Adapter\VideoAdapterInterface" or extend the RicardoFiorani\Adapter\AbstractServiceAdapter

A Fully functional example can be found Here.

PS: If you've made your awesome implementation of some well known service, feel free to send a Pull Request. All contributions are welcome :)

Using your own framework's template engine

A Fully functional example can be found Here.

Currently Suported Services

  • Youtube
  • Vimeo
  • Dailymotion
  • Facebook Videos

Currently Supported PHP Versions

  • PHP 5.3
  • PHP 5.4
  • PHP 5.5
  • PHP 5.6
  • PHP 7.0
  • PHP 7.1
  • PHP 7.2

Please note that lib is not passing tests on HHVM, therefore, we can't guarantee it will work properly. Please use it on your own risk.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].