1. Go to this page and download the library: Download vhar/laravel-embed-video 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/ */
public function handle(string $url): EmbedData
{
...
$data = new EmbedData();
return $data->setId($id)->setVideo($embedURL)->setCover($coverURL);}
public function allowedDomains(): array
{
return [
'youtu.be',
'youtube.com',
];
}
class AppServiceProvider extends ServiceProvider
{
public function register(): void
{
...
\Vhar\LaravelEmbedVideo\Facades\VideoHosting::hosting('you_alias', \YouNamespace\YouClassHandlerService::class);
}
}
xml
<testsuites>instance
...
<testsuite name="Embed Video">
<directory suffix="Test.php">./vendor/vhar/laravel-embed-video/tests/</directory>
</testsuite>
</testsuites>
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.