PHP code example of pingpong / oembed

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

    

pingpong / oembed example snippets


    'Pingpong\Oembed\OembedServiceProvider'

    'Oembed'           => 'Pingpong\Oembed\Facades\Oembed',

$info = Oembed::get('https://www.youtube.com/watch?v=PP1xn5wHtxE');

//Get content info

$info->title; //The page title
$info->description; //The page description
$info->url; //The canonical url
$info->type; //The page type (link, video, image, rich)

$info->images; //List of all images found in the page
$info->image; //The image choosen as main image
$info->imageWidth; //The with of the main image
$info->imageHeight; //The height  of the main image

$info->code; //The code to embed the image, video, etc
$info->width; //The with of the embed code
$info->height; //The height of the embed code
$info->aspectRatio; //The aspect ratio (width/height)

$info->authorName; //The (video/article/image/whatever) author 
$info->authorUrl; //The author url

$info->providerName; //The provider name of the page (youtube, twitter, instagram, etc)
$info->providerUrl; //The provider url
$info->providerIcons; //All provider icons found in the page
$info->providerIcon; //The icon choosen as main icon

$info = Oembed::cache($url, $options);