Skip to content

embedvsembera

MIT 68 6 2,072
4.2 thousand (month) Oct 26 2013 v4.4.11(a month ago)
330 2 2 MIT
Sep 11 2013 3.2 thousand (month) 2.0.39(a month ago)

PHP library to get information from any web page (using oembed, opengraph, twitter-cards, scrapping the html, etc). It's compatible with any web service (youtube, vimeo, flickr, instagram, etc) and has adapters to some sites like (archive.org, github, facebook, etc).

Embera is an Oembed consumer library written in PHP. It takes urls from a text and queries the matching service for information about the media and embeds the resulting html. It supports +150 sites, such as Youtube, Twitter, Livestream, Dailymotion, Instagram, Vimeo and many many more.

Example Use


use Embed\Embed;

$embed = new Embed();

//Load any url:
$info = $embed->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->keywords; //The page keywords

$info->image; //The thumbnail or main image

$info->code->html; //The code to embed the image, video, etc
$info->code->width; //The exact width of the embed code (if exists)
$info->code->height; //The exact height of the embed code (if exists)
$info->code->ratio; //The aspect ratio (width/height)

$info->authorName; //The resource author
$info->authorUrl; //The author url

$info->cms; //The cms used
$info->language; //The language of the page
$info->languages; //The alternative languages

$info->providerName; //The provider name of the page (Youtube, Twitter, Instagram, etc)
$info->providerUrl; //The provider url
$info->icon; //The big icon of the site
$info->favicon; //The favicon of the site (an .ico file or a png with up to 32x32px)

$info->publishedTime; //The published time of the resource
$info->license; //The license url of the resource
$info->feeds; //The RSS/Atom feeds
use Embera\Embera;

$embera = new Embera();
print_r($embera->getUrlData([
    'https://vimeo.com/374131624',
    'https://www.flickr.com/photos/bees/8597283706/in/photostream',
]));

// this will generate:
Array
(
    [https://vimeo.com/374131624] => Array
        (
            [type] => video
            [version] => 1.0
            [provider_name] => Vimeo
            [provider_url] => https://vimeo.com/
            [title] => VACATION movie
            [author_name] => Andrey Kasay
            [author_url] => https://vimeo.com/andreykasay
            [is_plus] => 0
            [account_type] => basic
            [html] => <iframe src="......."></iframe>
            [width] => 426
            [height] => 240
            [duration] => 146
            [description] => Остросюжетное кино про жизнь
            [thumbnail_url] => https://i.vimeocdn.com/video/832478725_295x166.jpg
            [thumbnail_width] => 295
            [thumbnail_height] => 166
            [thumbnail_url_with_play_button] => https://i.vimeocdn.com/......Fcrawler_play.png
            [upload_date] => 2019-11-19 06:27:37
            [video_id] => 374131624
            [uri] => /videos/374131624
            [embera_using_fake_response] => 0
            [embera_provider_name] => Vimeo
        )
    [https://www.flickr.com/photos/bees/8597283706/in/photostream] => Array
        (
            [type] => photo
            [flickr_type] => photo
            [title] => Durumu
            [author_name] => ‮‭‬bees
            [author_url] => https://www.flickr.com/photos/bees/
            [width] => 1024
            [height] => 723
            [url] => https://live.staticflickr.com/8385/8597283706_7b51ea50b1_b.jpg
            [web_page] => https://www.flickr.com/photos/bees/8597283706/
            [thumbnail_url] => https://live.staticflickr.com/8385/8597283706_7b51ea50b1_q.jpg
            [thumbnail_width] => 150
            [thumbnail_height] => 150
            [web_page_short_url] => https://flic.kr/p/e6HjVq
            [license] => All Rights Reserved
            [license_id] => 0
            [html] => .........
            [version] => 1.0
            [cache_age] => 3600
            [provider_name] => Flickr
            [provider_url] => https://www.flickr.com/
            [embera_using_fake_response] => 0
            [embera_provider_name] => Flickr
            [html_alternative] => ........
        )
)

Alternatives / Similar


Was this page helpful?