1. Go to this page and download the library: Download vhar/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/ */
use Vhar\EmbedVideo\Rules\EmbedVideoRule;
$request->validate([
'name' => ['
public function handle(string $url): EmbedDataDTO
{
...
return new EmbedDataDTO(
id: $id,
video: $embedURL,
cover: $coverURL
);
}
public function allowedDomains(): array
{
return [
'youtu.be',
'youtube.com',
];
}
class AppServiceProvider extends ServiceProvider
{
public function register(): void
{
...
\Vhar\EmbedVideo\Facades\VideoHosting::hosting('you_alias', \YouNamespace\YouClassHandlerService::class);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.