PHP code example of baraja-core / video-token

1. Go to this page and download the library: Download baraja-core/video-token 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/ */

    

baraja-core / video-token example snippets


$token = new \Baraja\VideoToken\VideoToken(
    'https://www.youtube.com/watch?v=_Gi_LQ0a8EA'
);

// or

$token = new \Baraja\VideoToken\VideoToken('_Gi_LQ0a8EA', 'youtube');

echo $token->getToken(); // _Gi_LQ0a8EA
echo $token->getProvider(); // youtube
echo $token->getThumbnailUrl(); // https://img.youtube.com/vi/_Gi_LQ0a8EA/maxresdefault.jpg
echo $token->getUrl(); // https://www.youtube.com/embed/_Gi_LQ0a8EA?rel=0