torann/embedder

Fetch embeddable links from text and fetch OpenGraph data.

Maintainers

👁 torann

Package info

github.com/Torann/embedder

pkg:composer/torann/embedder

Statistics

Installs: 465

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 0

0.0.4 2017-09-19 23:49 UTC

Requires

  • php: >=5.5.9

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

BSD 2-Clause 633d95150dd3a6f4f06987975b8b109a001eaa4b

  • Daniel Stainback <torann.woop@gmail.com>

oembedaudioyoutubedailymotionvimeovideosopengraphembedembeddervine

This package is auto-updated.

Last update: 2026-06-08 13:35:58 UTC


README

👁 Build Status
👁 Latest Stable Version
👁 Total Downloads
👁 Patreon donate button
👁 Donate weekly to this project using Gratipay
👁 Donate to this project using Flattr
👁 Donate to this project using Paypal

Fetch embeddable links from text.

Installation

Composer

From the command line run:

$ composer require torann/embedder

Examples

Extracting First Valid Video

$text = 'Hi, I just saw this video https://www.youtube.com/watch?v=W9cA9Z4bNzk and the http://youtu.be/dMH0bHeiddddd';
$embedder = new \Torann\Embedder\Embed();

$output = $embedder->getUrl($text);

Will output string:

//www.youtube.com/embed/W9cA9Z4bNzk

Extracting All Videos

$text = 'Hi, I just saw this video https://www.youtube.com/watch?v=W9cA9Z4bNzk and the http://youtu.be/dMH0bHeiddddd';
$embedder = new \Torann\Embedder\Embed();

$output = $embedder->getUrls($text);

Will output array:

[
 'https://www.youtube.com/watch?v=W9cA9Z4bNzk' => '//www.youtube.com/embed/W9cA9Z4bNzk',
 'http://youtu.be/dMH0bHeiddddd' => '//www.youtube.com/embed/dMH0bHeiddddd'
]

OpenGraph

Access OpenGraph meta data of a given URL.

$embedder = new \Torann\Embedder\Embed();

$output = $embedder->getMeta('http://www.rottentomatoes.com/m/771439257');

Will output array:

[
 "description" => "In this heart-pounding thriller from acclaimed writer and director Mike Flanagan (Oculus, Before I Wake), silence takes on a terrifying new dimension for a..."
 "title" => "Hush"
 "type" => "video.movie"
 "image" => "https://resizing.flixster.com/R6FvucOnw5bYh_sffSMbvFSXX2w=/220x326/v1.bTsxMTcwNDk2MDtqOzE2OTc1OzIwNDg7MjIwOzMyNg"
 "image" => [
 "width" => "800"
 "height" => "1200"
 ],
 "url" => "http://www.rottentomatoes.com/m/771439257/"
]

Change Log

v0.0.3

  • Add simple OpenGraph support

v0.0.2

  • Fix return type of single urls

v0.0.1

  • First release