PHPackages                             globaloxs/yii2-video-embed-widget - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. globaloxs/yii2-video-embed-widget

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

globaloxs/yii2-video-embed-widget
=================================

Yii2 Extension for Generating Video Embed Codes from Video URLs

079PHP

Since Apr 1Pushed 10y ago2 watchersCompare

[ Source](https://github.com/david-oxs/yii2-video-embed-widget)[ Packagist](https://packagist.org/packages/globaloxs/yii2-video-embed-widget)[ RSS](/packages/globaloxs-yii2-video-embed-widget/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Yii2 Video Embed Widget
=======================

[](#yii2-video-embed-widget)

Yii2 Extension for Generating Video Embed Codes from Video URLs.

This widget will return the video embed code when passed a valid video url. It's compatible with any web service, such as youtube, vimeo, dailymotion, hulu, etc.

This widget accepts the following parameters:

- `url`: \*\* required \*\*
- `resonsive`: defaults to `true`
- `container_id`: defaults to `""` empty string
- `container_class`: defaults to `""` empty string
- `show_errors`: defaults to `false`

> NOTE: This extension depends on the \[embed/embed\] () package, created by [Oscar Otero](https://github.com/oscarotero). Oscar's Embed class does all the heavy lifting in generating the video embed code based on the supplied video URL. I've simply created a Yii2 wrapper widget with some additional settings.

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require cics/yii2-video-embed-widget "dev-master"

```

or add

```
"cics/yii2-video-embed-widget": "dev-master"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

Once the extension is installed, simply use it in your code by adding

```

```

or add the namespace first and only reference the class name when echoing the returned embed code

```
use cics\widgets\VideoEmbed;
...
