pavlyshyn / oembed by pavlyshyn
forked from jooorooo/oembed

Laravel 5 - Retrieve page info using oembed, opengraph, etc.
3,161
1
2
Package Data
Maintainer Username: pavlyshyn
Maintainer Contact: jooorooo@gmail.com (Georgi Nachev)
Package Create Date: 2017-04-11
Package Last Update: 2017-09-21
Language: PHP
License: BSD-3-Clause
Last Refreshed: 2024-12-16 15:02:36
Package Statistics
Total Downloads: 3,161
Monthly Downloads: 1
Daily Downloads: 0
Total Stars: 1
Total Watchers: 2
Total Forks: 1
Total Open Issues: 0

Oembed

Laravel 5 - Retrieve page info using oembed, opengraph, etc.

Server Requirements

Require PHP 5.5+ or higher.

Installation

Open your composer.json file, and add the new required package.

"simexis/oembed": "1.0.*"

Next, open a terminal and run.

composer update

After the composer updated. Add new service provider in app/config/app.php.

    'Simexis\Oembed\OembedServiceProvider'

Next, Add new alias.

    'Oembed'           => 'Simexis\Oembed\OembedFacade',

Done.

Usage

Basic Usage

$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 width 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

Caching the results.

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

License

This package is open-sourced software licensed under The BSD 3-Clause License