PHPackages                             cohensive/oembed - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. cohensive/oembed

ActiveLibrary[Image &amp; Media](/categories/media)

cohensive/oembed
================

Media embed generation using OEmbed protocol.

v0.20.1(8mo ago)3673.8k—0.7%7[1 issues](https://github.com/KaneCohen/oembed/issues)BSD-3-ClausePHPPHP ^8.0

Since Jan 9Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/KaneCohen/oembed)[ Packagist](https://packagist.org/packages/cohensive/oembed)[ RSS](/packages/cohensive-oembed/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (1)Versions (34)Used By (0)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/b55c41c699fb4a177e1e3b972b1b0c8c795d5443a3f63fc93dfad19379f60cbd/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4b616e65436f68656e2f6f656d6265642f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/KaneCohen/oembed/?branch=master)[![Build Status](https://camo.githubusercontent.com/ea878e16599260ba68b3c8e2305f21fa8bf003b8c6e03388fb4169d79c4bd2e9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4b616e65436f68656e2f6f656d6265642f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/KaneCohen/oembed/build-status/master)[![Code Intelligence Status](https://camo.githubusercontent.com/cae475df79b4600ae7622f8a7db3a49a0ee18ba4a422c15ade63df4ebf7a5743/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4b616e65436f68656e2f6f656d6265642f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/code-intelligence)

OEmbed
======

[](#oembed)

PHP library to retreive and display embed media from various media providers that support OEmbed data format. Websites such as YouTube, Vimeo, Twitter, Imgur and others.

This library also comes with support for direct mp4/video sources and some of the media providers that don't use OEmbed.

Installation
------------

[](#installation)

Library is written in PHP 8 with various neat features it gives, so apologies to everybody who wanted to use it in previous versions of PHP. If you do need similar library, I could recommend checking my previous package in this field: [cohensive/embed](https://github.com/KaneCohen/embed).

Add following require to your `composer.json` file:

```
"cohensive/oembed": "dev-master"
// or
"cohensive/oembed": "^0.16"

```

Then run `composer install` or `composer update` to download it and autoload.

Or run:

```
$ composer require cohensive/oembed

```

If you're installing this library and want to utilize it with Laravel, package should automatically load its Service Provider.

If you plan to use OEmbed facade with Laravel, add Facade to your app.php config file in aliases section:

```
'aliases' => array(

	//...
	'OEmbed' => 'Cohensive\OEmbed\Facades\OEmbed'
	//...

)

```

Usage
-----

[](#usage)

Standalone use:

```
// Use of factory will automatically load list of providers.
$factory = new \Cohensive\OEmbed\Factory();
$embed = $factory->get('http://youtu.be/uifYHNyH-jA');

if ($embed) {
	// Print default embed html code.
	echo $embed->html();

	// Print embed html code with custom width. Works for IFRAME and VIDEO html embed code.
	echo $embed->html(['width' => 600]);

	// Checks if embed data contains details on thumbnail.
	$embed->hasThumbnail();

	// Returns embed "src" - URL string / array of strings / null for current embed.
	// Accepts same options as "html" method.
	$embed->src();

	// Returns an array containing thumbnail details: url, width and height.
	$embed->thumbnail();

	// Returns an array containing all available embed data including default HTML code.
	$embed->data();
}

```

Laravel use:

```
// Either use Facade:
$embed = OEmbed::get('http://youtu.be/uifYHNyH-jA');

// Load via Dependency Injection:
public function method(OEmbed $oembed) {
	$embed = OEmbed::get('http://youtu.be/uifYHNyH-jA');
}

if ($embed) {
	// Print default embed html code.
	echo $embed->html();

	// Print embed html code with custom width. Works for IFRAME and VIDEO html embed code.
	echo $embed->html(['width' => 600]);

	// Checks if embed data contains details on thumbnail.
	$embed->hasThumbnail();

	// Returns an array containing thumbnail details: url, width and height.
	$embed->thumbnail();

	// Return thumbnail url if it exists or null.
	$embed->thumbnailUrl();

	// Returns an array containing all available embed data including default HTML code.
	$embed->data();
}

```

Config
------

[](#config)

Library comes with a big config file located in `resources/` folder. That file contains an array where you can specify few things on a global basis and will you to pick which media providers you want to be used and which not.

Config file will be automatically loaded if you're using library with Laravel, which you can also publish and edit:

```
$ php artisan vendor:publish

```

If you're using OEmbed in standalone mode, you can add your own config file into Factory or OEmbed classes.

### Important Changes

[](#important-changes)

Config format changed to use `snake_case` array keys instead of previously used `camelCase`.

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance59

Moderate activity, may be stable

Popularity43

Moderate usage in the ecosystem

Community12

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 97.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~54 days

Recently: every ~39 days

Total

33

Last Release

255d ago

PHP version history (2 changes)v0.1PHP ^7.4|^8.0

v0.4PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/578455?v=4)[Kane Cohen](/maintainers/KaneCohen)[@KaneCohen](https://github.com/KaneCohen)

---

Top Contributors

[![KaneCohen](https://avatars.githubusercontent.com/u/578455?v=4)](https://github.com/KaneCohen "KaneCohen (46 commits)")[![DrAliRagab](https://avatars.githubusercontent.com/u/37520558?v=4)](https://github.com/DrAliRagab "DrAliRagab (1 commits)")

---

Tags

laravelyoutubemediavimeoembedoembed

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cohensive-oembed/health.svg)

```
[![Health](https://phpackages.com/badges/cohensive-oembed/health.svg)](https://phpackages.com/packages/cohensive-oembed)
```

###  Alternatives

[cohensive/embed

Media Embed (for Laravel or as a standalone).

120380.9k](/packages/cohensive-embed)[essence/essence

Extracts information about medias on the web, like youtube videos, twitter statuses or blog articles.

781583.8k3](/packages/essence-essence)[mpratt/embera

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

3645.8M25](/packages/mpratt-embera)[classic-o/nova-media-library

Tool and field that will let you managing files and add them to the posts

154177.4k](/packages/classic-o-nova-media-library)[mediamonks/sonata-media-bundle

A powerful, flexible and easy to use alternative for the existing Sonata Media Bundle

109.8k](/packages/mediamonks-sonata-media-bundle)[tomatophp/filament-media-manager

Manage your media files using spatie media library with easy to use GUI for FilamentPHP

14749.5k3](/packages/tomatophp-filament-media-manager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
