public static function getVideoEmbed($url, $width = 560, $height = 315)
    {
        switch (true) {
            case preg_match('/youtu/i', $url):

                $id = self::getVideoId($url);

                if (!$id) {
                    return '<iframe width="' . $width . '" height="' . $height . '" src="//www.youtube.com/embed/' . $id . '?rel=0" frameborder="0" allowfullscreen></iframe>';
                }

                return false;

            case preg_match('/vimeo/i', $url):

                $id = self::getVideoId($url);

                if (!$id) {
                    return '<iframe src="//player.vimeo.com/video/' . $id . '?portrait=0" width="' . $width . '" height="' . $height . '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
                }

                return false;

            case preg_match('/dailymotion/i', $url):

                $id = self::getVideoId($url);

                if (!$id) {
                    return '<iframe frameborder="0" width="' . $width . '" height="' . $height . '" src="//www.dailymotion.com/embed/video/' . $id . '"></iframe>';
                }

                return false;
        }
    }
public static function getVideoEmbed($url, $width = 560, $height = 315)
    {
        switch (true) {
            case preg_match('/youtu/i', $url):

                $id = self::getVideoId($url);

                if (!$id) {
                    return '<iframe width="' . $width . '" height="' . $height . '" src="//www.youtube.com/embed/' . $id . '?rel=0" frameborder="0" allowfullscreen></iframe>';
                }

                return false;

            case preg_match('/vimeo/i', $url):

                $id = self::getVideoId($url);

                if (!$id) {
                    return '<iframe src="//player.vimeo.com/video/' . $id . '?portrait=0" width="' . $width . '" height="' . $height . '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
                }

                return false;

            case preg_match('/dailymotion/i', $url):

                $id = self::getVideoId($url);

                if (!$id) {
                    return '<iframe frameborder="0" width="' . $width . '" height="' . $height . '" src="//www.dailymotion.com/embed/video/' . $id . '"></iframe>';
                }

                return false;
        }
    }
public static function getVideoEmbed ( $ url , $ width = 560 , $ height = 315 ) { switch ( true ) { case preg_match ( '/youtu/i' , $ url ) : $ id = self :: getVideoId ( $ url ) ; if ( ! $ id ) { return '<iframe width="' . $ width . '" height="' . $ height . '" src="//www.youtube.com/embed/' . $ id . '?rel=0" frameborder="0" allowfullscreen></iframe>' ; } return false ; case preg_match ( '/vimeo/i' , $ url ) : $ id = self :: getVideoId ( $ url ) ; if ( ! $ id ) { return '<iframe src="//player.vimeo.com/video/' . $ id . '?portrait=0" width="' . $ width . '" height="' . $ height . '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>' ; } return false ; case preg_match ( '/dailymotion/i' , $ url ) : $ id = self :: getVideoId ( $ url ) ; if ( ! $ id ) { return '<iframe frameborder="0" width="' . $ width . '" height="' . $ height . '" src="//www.dailymotion.com/embed/video/' . $ id . '"></iframe>' ; } return false ; } }
Get Video embed from Youtube, Vimeo or Dailymotion

@param $url
@param int $width
@param int $height
@return bool|string
Get Video embed from Youtube Vimeo or Dailymotion