, (*1)
Embryo/Embed
This is a library intended to easily embed data from different kind of sources., (*2)
Installation
- via composer :
composer require embryo/embed
Usage
<?php
require_once __DIR__.'/vendor/autoload.php';
$url = 'https://www.youtube.com/watch?v=2_HXUhShhmY';
$embed = new \Embryo\Embed($url);
echo $embed->getEmbeddedCode();
Will display :, (*3)
<iframe
width="400"
height="225"
src="https://www.youtube.com/embed/2_HXUhShhmY"
frameborder="0"
allow="autoplay; encrypted-media"
allowfullscreen>
</iframe>
Configuration
Some of the default values can be overridden by editing the correct env value., (*4)
We strongly suggest using phpdotenv
to do so., (*5)
Available values are:, (*6)
-
EMBED_WIDTH
(Used on videos, default value is 400)
-
EMBED_RATIO
(Used on videos, default value is 16/9)
Available sources
- Video services
- DailyMotion
- Vimeo
- Youtube
Suggesting another source
All suggestions are welcome, just create an issue on the repository's tracker, (*7)