PHP code example of webwizardsusa / laravel-oembed

1. Go to this page and download the library: Download webwizardsusa/laravel-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/ */

    

webwizardsusa / laravel-oembed example snippets


app(\Webwizardsusa\OEmbed\OEmbed::class)->fromUrl('https://www.youtube.com/watch?v=gaeV9Jp3Uhk')->toArray()


class YoutubeProvider extends AbstractOembedProvider
{

    protected array $regexes = [
        '#https?://((m|www)\.)?youtube\.com/watch.*#i',
        '#https?://((m|www)\.)?youtube\.com/playlist.*#i',
        '#https?://((m|www)\.)?youtube\.com/shorts/*#i',
        '#https?://((m|www)\.)?youtube\.com/live/*#i',
        '#https?://youtu\.be/.*#i',
    ];
    protected string $oembedUrl = 'https://www.youtube.com/oembed';


    public function name(): string
    {
        return 'youtube';
    }
}


   public function pull(OEmbedUrl $url, $apiUrl):OEmbedResponse
bash
php artisan vendor:publish --tag=oembed-config