PHP code example of mor / yt-check

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

    

mor / yt-check example snippets


use YtCheck\Yt;


$id = 'BUykFA7FCo4'; // It can be a url.

$isValid = Yt::isValid($id); // True or False


$url = 'https://www.youtube.com/shorts/BUykFA7FCo4'; // It can be an id.

$video = Yt::oembed($url);
$title = $video->title;

// OR

$video = new Yt($url);
$title = $video->title; // Returns title
$author_name = $video->author_name;
$author_url = $video->author_url;
$type = $video->type;
$thumbnail_url = $video->thumbnail_url;
$html = $video->html; // Iframe of video