This is a library intended to easily embed data from different kind of sources.
- via composer :
composer require embryo/embed
<?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 :
<iframe
width="400"
height="225"
src="https://www.youtube.com/embed/2_HXUhShhmY"
frameborder="0"
allow="autoplay; encrypted-media"
allowfullscreen>
</iframe>
Some of the default values can be overridden by editing the correct env value.
We strongly suggest using phpdotenv to do so.
Available values are:
EMBED_WIDTH
(Used on videos, default value is 400)EMBED_RATIO
(Used on videos, default value is 16/9)
- Video services
- DailyMotion
- Vimeo
- Youtube
All suggestions are welcome, just create an issue on the repository's tracker