PHP code example of yocto / yoclib-oembed

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

    

yocto / yoclib-oembed example snippets


use YOCLIB\OEmbed\OEmbed;

$data = [
    'version' => '1.0',
];

$json = OEmbed::encode($data,'json');
// or
$xml = OEmbed::encode($data,);

use YOCLIB\OEmbed\OEmbed;

$json = '{"version":"1.0"}';
$data = OEmbed::decode($json,'json');

// or

$xml = '<oembed><version>1.0</version></oembed>';
$data = OEmbed::decode($xml);