wolfpack-it/yii2-youtube

Yii2 Widget for YouTube

v1.0.0 2019-09-27 09:07 UTC

This package is auto-updated.

Last update: 2022-07-11 13:30:40 UTC


README

This extension provides a widget to show a YouTube player for Yii2 Framework.

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require wolfpack-it/yii2-youtube

or add

"wolfpack-it/yii2-youtube": "^<latest version>"

to the require section of your composer.json file.

Usage

echo \WolfpackIT\youtube\widgets\YouTube::widget([
    'id' => 'yt-video-player',
    'videoId' => '<videoId>',
    'enableJsApi' => true,
    'jsEvents' => [
        'onStateChange' => new JsExpression('onStateChange'),
    ],
]);

Full width or responseive video

If you want to have the video to be full width or responsive, check out the following link: https://avexdesigns.com/responsive-youtube-embed/.

Credits

License

The MIT License (MIT). Please see LICENSE for more information.