1. Go to this page and download the library: Download magnetolv1/oembed library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
magnetolv1 / oembed example snippets
return [
/*
* 캐시 설정
*/
'cache' => [
/*
* 캐시 저장소 설정
* null이면 기본(default) 사용
*/
'store' => null,
/*
* 캐시 만료시간(단위 minute)
* 0 이면 캐시 사용안함
*/
'expire' => 0,
],
/*
* Embera\Embera 설정값
* https://github.com/mpratt/Embera/blob/master/doc/01-usage.md
*/
'config' => [
/*
* true/false - Wether the library should use providers that support https on their html response.
*/
'https_only' => false,
/*
* https://github.com/mpratt/Embera/blob/master/doc/04-fake-responses.md
* const ALLOW_FAKE_RESPONSES = 1;
* const DISABLE_FAKE_RESPONSES = 2;
* const ONLY_FAKE_RESPONSES = 3;
*/
'fake_responses' => 2,
/*
* Array with tags that should be ignored when detecting urls from a text. So that for example Embera doesnt replace urls inside an iframe or img tag.
*/
'ignore_tags' => ['pre', 'code', 'a', 'img', 'iframe', 'oembed'],
/*
* true/false - Wether we modify the html response in order to get responsive html. - More Information in the responsive data documentation. (BETA)
*/
'responsive' => false,
'width' => 0,
'height' => 0,
/*
* Set the maximun width of the embeded resource
*/
'maxheight' => 0,
/*
* Set the maximun width of the embeded resource
*/
'maxwidth' => 0,
],
/*
* Provider 리스트
* providers가 없는 경우 DefaultProviderCollection를 사용하여 전체 Provider가 등록됨
*/
'providers' => [
Embera\Provider\Youtube::class,
]
];
use MagnetoLv1\Oembed\Facades\Oembed;
$oembed = Oembed::get('https://www.youtube.com/watch?v=QSV0LghD1D8');
echo json_encode($oembed);
sh
php artisan vendor:publish --provider="MagnetoLv1\Oembed\OembedServiceProvider"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.