PHP code example of zoon / commonmark-ext-youtube-iframe

1. Go to this page and download the library: Download zoon/commonmark-ext-youtube-iframe 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/ */

    

zoon / commonmark-ext-youtube-iframe example snippets

 php
use League\CommonMark\CommonMarkConverter;
use Zoon\CommonMark\Ext\YouTubeIframe\YouTubeIframeExtension;

$converter = new CommonMarkConverter([
    'youtube_iframe' => [
        'width' => '600',
        'height' => '300',
        'allow_full_screen' => true,
    ],
]);

$converter->getEnvironment()->addExtension(new YouTubeIframeExtension());

echo $converter->convert('Check this: [](https://youtu.be/mVnSpPMgoWM?t=10)')->getContent();
echo $converter->convert('Check this: [](https://www.youtube.com/watch?v=mVnSpPMgoWM&t=10)')->getContent();