Oembed consumer library. Converts urls into their html embed code. Supports 150+ sites, such as Youtube, Twitter, vimeo, Instagram etc.

Fund package maintenance!

Installs: 3 271 288

Dependents: 19

Suggesters: 0

Security: 0

Stars: 324

Watchers: 21

Forks: 59

Open Issues: 2

2.0.36 2023-11-17 23:59 UTC


Build Status Total Downloads Monthly Downloads Latest Stable Version

Support via PayPal

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.


Install the latest stable version with:

$ composer require mpratt/embera:~2.0

Standalone Installation (without Composer)

Download the latest release or clone this repository and include the Àutoloader.php file inside the Embera/src directory.

require '....../Autoloader.php';

use Embera\Embera;

$embera = new Embera();


  • PHP >= 7.0 (It should work on 5.6)
  • Curl or allow_url_fopen should be enabled

Basic Usage

The most common or basic example is this one:

use Embera\Embera;

$embera = new Embera();
echo $embera->autoEmbed('Hi! Have you seen this video? Its the best!');

The last example returns something like the following text:

Hi! Have you seen this video?
  allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
Its the best!

You can also inspect urls for their oembed data:

use Embera\Embera;

$embera = new Embera();

That will return something like this

    [] => Array
            [type] => video
            [version] => 1.0
            [provider_name] => Vimeo
            [provider_url] =>
            [title] => VACATION movie
            [author_name] => Andrey Kasay
            [author_url] =>
            [is_plus] => 0
            [account_type] => basic
            [html] => <iframe src="......."></iframe>
            [width] => 426
            [height] => 240
            [duration] => 146
            [description] => Остросюжетное кино про жизнь
            [thumbnail_url] =>
            [thumbnail_width] => 295
            [thumbnail_height] => 166
            [thumbnail_url_with_play_button] =>
            [upload_date] => 2019-11-19 06:27:37
            [video_id] => 374131624
            [uri] => /videos/374131624
            [embera_using_fake_response] => 0
            [embera_provider_name] => Vimeo
    [] => Array
            [type] => photo
            [flickr_type] => photo
            [title] => Durumu
            [author_name] => ‮‭‬bees‬
            [author_url] =>
            [width] => 1024
            [height] => 723
            [url] =>
            [web_page] =>
            [thumbnail_url] =>
            [thumbnail_width] => 150
            [thumbnail_height] => 150
            [web_page_short_url] =>
            [license] => All Rights Reserved
            [license_id] => 0
            [html] => .........
            [version] => 1.0
            [cache_age] => 3600
            [provider_name] => Flickr
            [provider_url] =>
            [embera_using_fake_response] => 0
            [embera_provider_name] => Flickr
            [html_alternative] => ........

The response data depends on the provider, each of them returns information about the consulted media, however this library always tries to provide an embeddable html key that can be used to embed the information on a html document.

This library has fake responses / Offline support which is a way of getting the html embeddable code without the need of querying the oembed provider. It also has caching support, provider collections, responsive embeds and many other features. You can find out more by reading the documentation below.


Migrating from version >= 1.9.x

The folder structure has changed, the library is now in the src folder and you can find an autoloader there if you are not using composer.

The configuration array has changed in order to make it simpler. Take a look at the Usage/Configuration instructions to update it.

The other major change is that the inspectUrlInfo() method is now called getUrlData(). The HtmlFormatter class does not exist anymore since the library allows now other type of templating.

Updating should be fairly easy, check the documentation.

Submitting bugs and feature requests

Bugs and feature request are tracked on GitHub


Michael Pratt - - See also the list of contributors which participated in this project.

If you like this library, it has been useful to you and want to support me, you can do it via paypal.

Support via PayPal


Embera is licensed under the MIT License - see the LICENSE file for details