yocto/yoclib-oembed

This yocLibrary enables your project to encode and decode OEmbed data in PHP.

v1.0.1 2024-10-02 13:04 UTC

This package is auto-updated.

Last update: 2024-11-02 13:40:18 UTC


README

This yocLibrary enables your project to encode and decode OEmbed data in PHP.

Status

PHP Composer codecov

Installation

composer require yocto/yoclib-oembed

Usage

Encoding

use YOCLIB\OEmbed\OEmbed;

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

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

Decoding

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);