embryo / embed
v0.1.1
2018-12-05 06:31 UTC
Requires
- guzzlehttp/guzzle: ^6.3
This package is auto-updated.
Last update: 2025-05-05 20:38:36 UTC
README
Embryo/Embed
This is a library intended to easily embed data from different kind of sources.
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 :
<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.
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)
Available sources
- Video services
- DailyMotion
- Vimeo
- Youtube
Suggesting another source
All suggestions are welcome, just create an issue on the repository's tracker