skeeks/youtube-helper

1.0.4 2019-04-25 06:43 UTC

This package is auto-updated.

Last update: 2024-10-25 18:07:26 UTC


README

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist skeeks/youtube-helper "*"

or add

"skeeks/youtube-helper": "*"

Examples

$youtube = new \skeeks\youtubeHelper\YoutubeHelper('https://www.youtube.com/watch?v=xr1kXiEtCmo');
$youtube = new \skeeks\youtubeHelper\YoutubeHelper('https://youtu.be/xr1kXiEtCmo');
$youtube = new \skeeks\youtubeHelper\YoutubeHelper('<iframe width="640" height="360" src="https://www.youtube.com/embed/xr1kXiEtCmo?rel=0&amp;controls=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>');
if ($youtube->getId())
{
    print_r($youtube->getId());
    print_r($youtube->getEmbedUrl());
    print_r($youtube->getImageUrl());
    print_r($youtube->getWatchUrl());
} else
{
    print_r('Parsing code error');
}
$youtube = new \skeeks\youtubeHelper\YoutubeHelper('https://www.youtube.com/watch?v=xr1kXiEtCmo');

if ($youtube->getId()
{
    echo '<iframe width="560" height="315" src="<?= $youtube->getEmbedUrl(); ?>?rel=0&amp;controls=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>';
}

skeeks!
SkeekS CMS (Yii2) — quickly, easily and effectively!
skeeks.com | cms.skeeks.com