2017 © Pedro Peláez
 

package youtube

Package for generate IFrame with youtube-link

image

fomvasss/youtube

Package for generate IFrame with youtube-link

  • Wednesday, June 13, 2018
  • by fomvasss
  • Repository
  • 1 Watchers
  • 4 Stars
  • 415 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 8 Versions
  • 50 % Grown

The README.md

Youtube

Latest Version on Packagist Software License Total Downloads, (*1)

Package for generate IFrame with youtube-link, (*2)

Install

composer require "fomvasss/youtube"

For Laravel < 5.5 register the service provider and aliases in config/app.php:, (*3)

  Fomvasss\Youtube\YoutubeServiceProvider::class,

Publish config:, (*4)

php artisan vendor:publish --provider="Fomvasss\Youtube\YoutubeServiceProvider" --tag="config"

Config

Edit file config/youtube.php, set: - 'rel' => 0, #show like videos after finish - 'autoplay' => 0, #autoplay video after open page - 'loop' => 0, #if 1 - repeat video - 'controls' => 1, #show control button in player - 'showinfo' => 1, #show info about video (title, time) - 'width' => 640, #width video - 'height' => 360, #height video - 'frameborder' => 0, #border on player, (*5)

  • 'bootstrap-responsive-embed' => false, #add bootstrap container with class "embed-responsive"
  • 'bootstrap-ratio' => '16by9', #set default ratio 1by1 | 4by3 | 16by9 | 21by9

Using

Using facades Youtube

use Fomvasss\Youtube\Facades\Youtube;

Now example, you can use next:, (*6)

Youtube::iFrame('https://www.youtube.com/watch?v=Dxk47dya8_k'); //returt String iframe

You get next iframe:, (*7)

<iframe width="640" height="360" src="http://www.youtube.com/embed/Dxk47dya8_k?rel=0&amp;autoplay=0&amp;controls=1&amp;showinfo=1" frameborder="0"></iframe>

You can set more parameters in array:, (*8)

$link = 'https://www.youtube.com/watch?v=Dxk47dya8_k';
Youtube::iFrame($link, ['rel'=> 0, 'autoplay'=>1, 'controls'=>1, 'showinfo'=>1, 'width'=>720, 'height'=>460, 'frameborder'=>0])

If are you not set some parameters, it well have default values (with config youtube.php):, (*9)

Using blade directive in template@youtube()

@youtube("https://www.youtube.com/watch?v=Dxk47dya8_k")
@youtube('<iframe width="640" height="360" src="https://www.youtube.com/embed/Dxk47dya8_k?rel=0&amp;controls=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>')
@youtube("Dxk47dya8_k")

Also you can set more parameters in array:, (*10)

@youtube('https://www.youtube.com/watch?v=Dxk47dya8_k', ['width'=>720, 'height'=>460,])

Using Bootstrap responsive container

If in config/youtube.php sett 'bootstrap-responsive-embed' => true, or array parameters is set 'bootstrap-responsive-embed' => true then we give next:, (*11)

<div class="embed-responsive embed-responsive-16by9">
  <iframe class="embed-responsive-item" src="..."></iframe>
</div>

Then the parameters height & weight are not using (ignoring) You also can use bootstrap-ratio parameters. Available next value ratio: 1by1 | 4by3 | 16by9 | 21by9, (*12)

Using helper-function youtube_iframe()

youtube_iframe('https://www.youtube.com/watch?v=Dxk47dya8_k');

Other method and API are back here:

  • https://developers.google.com/youtube/player_parameters?hl=ru
  • http://yournet.kz/blog/php/vstavka-video-iz-youtube-po-ssylke-php

The Versions

13/06 2018

dev-master

9999999-dev

Package for generate IFrame with youtube-link

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

by Fomin Vasyl

laravel video youtube

13/06 2018

v1.3.0

1.3.0.0

Package for generate IFrame with youtube-link

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

by Fomin Vasyl

laravel video youtube

19/04 2017

v1.2.2

1.2.2.0

Package for generate IFrame with youtube-link

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

by Fomin Vasyl

10/04 2017

v1.2.1

1.2.1.0

Package for generate IFrame with youtube-link

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

by Fomin Vasyl

05/04 2017

v1.2.0

1.2.0.0

Package for generate IFrame with youtube-link

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

by Fomin Vasyl

15/03 2017

v1.1.1

1.1.1.0

Package for generate IFrame with youtube-link

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

by Fomin Vasyl

15/03 2017

v1.1

1.1.0.0

Package for generate IFrame with youtube-link

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

by Fomin Vasyl

13/02 2017

v1.0

1.0.0.0

Package for generate IFrame with youtube-link

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

by Fomin Vasyl