mraafatcode / embedcreator
Laravel package to create HTML embed code using URL only, supports Facebook, Youtube, Instagram, Twitter, Vimeo and Dailymotion
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 1
Open Issues: 0
Type:package
Requires
- php: >= 5.6
This package is auto-updated.
Last update: 2024-09-28 23:41:28 UTC
README
HTML Embed Creator Package For Laravel
Laravel package to create HTML embed code using URL only
Supports Facebook, Youtube, Instagram, Twitter, Vimeo and Dailymotion
Installing.
Via Composer
composer require mraafatcode/embedcreator
After you have installed Package, open your Laravel config file config/app.php and add the following lines.
In the $providers array add the service providers for this package.
MraafatCode\EmbedCreator\Providers\EmbedCreatorProvider::class
Add the facade of this package to the $aliases array.
'EmbedCreator' => MraafatCode\EmbedCreator\EmbedCreator::class,
How to use it?
By use class EmbedCreator
and pass url to url()
then pass maxWidth()
in pixels(px) then embed type function at end use get()
.
Embed type functions
youtube()
facebook()
instagram()
twitter()
vimeo()
dailymotion()
Note!
You can create embed without set the max width so the code will run with default width.
Examples
// $url = "VIDEO_URL" $youtuebEmbed = EmbedCreator::url($url)->maxWidth(560)->youtube()->get(); // $url = "VIDEO_URL" $VimeoEmbed = EmbedCreator::url($url)->maxWidth(600)->vimeo()->get(); // $url = "VIDEO_URL" $dailymotionEmbed = EmbedCreator::url($url)->maxWidth(600)->dailymotion()->get(); // $url = "TWEET_URL" $twitterEmbed = EmbedCreator::url($url)->maxWidth(450)->twitter()->get(); // $url = "VIDEO_OR_IMAGE_URL" $instagramEmbed = EmbedCreator::url($url)->instagram()->get(); // $url = "POST_URL" $facebookEmbed = EmbedCreator::url($url)->facebook()->get();