samo/youtubeiframe
Composer 安装命令:
composer require samo/youtubeiframe
包简介
get a youtube video embedded iframe easly from url or video id
README 文档
README
get youtube players iframes from URL or Video ID easily
install
composer require samo/youtubeiframe
Usage
In controller
use Samo\YoutubeIframe\Iframe; public function index() { $iframe = Iframe::css('border-radius:50px;') ->width(100,'%') ->height(400,'px') ->noFullScreen() ->get('https://www.youtube.com/watch?v=35JzR2ymxJE'); return $iframe; }
Result:
In view
<div class="video_container">
{!! Samo\YoutubeIframe\Iframe::css('border-radius:50px;')
->width(100,'%')
->height(400,'px')
->noFullScreen()
->get('https://www.youtube.com/watch?v=35JzR2ymxJE')!!}
</div>
Available methods:
css($str)
Defines additional CSS properities sperated by ';'
Example :
Iframe::css('border:1px solid #000;opacity:0.7')->get('35JzR2ymxJE');
height($val=300,$unit='px')
Sets the player height (Default is 300px)
Example :
Iframe::height(500,'px')->get('35JzR2ymxJE');
width($val=500,$unit='px')
Sets the player width (default is 500px)
Example :
Iframe::width(500,'px')->get('35JzR2ymxJE');
get($urlOrID)
Returns the Iframe markup you can pass URL or Video ID
Accepted url format :
youtube.com/watch?v=xxxxxx
youtu.be.com/xxxxxxx
youtube.com/?v=xxxxxx
noFullScreen()
disable full screen feature
addAttribute($att)
adds a HTML attributes
Example :
Iframe::addAttribute('class="pt-5"')->addAttribute('id="pl1")->get('35JzR2ymxJE');
统计信息
- 总下载量: 42
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-08-14