pingpong / oembed
Laravel 4 - 使用oembed, opengraph等检索页面信息。
1.0.3
2014-09-10 18:38 UTC
Requires
- php: >=5.4.0
- embed/embed: 1.7.0
- illuminate/cache: 4.2.*
- illuminate/support: 4.2.*
Requires (Dev)
- mockery/mockery: 0.9.*
- phpunit/phpunit: 4.1.*
This package is not auto-updated.
Last update: 2024-09-24 02:43:55 UTC
README
Laravel 4 - 使用oembed, opengraph等检索页面信息。
服务器要求
Require PHP 5.4+ or higher.
安装
打开您的composer.json文件,并添加新的必需包。
"pingpong/oembed": "1.0.*"
接下来,打开终端并运行。
composer update
在composer更新后,在app/config/app.php中添加新的服务提供者。
'Pingpong\Oembed\OembedServiceProvider'
接下来,添加新的别名。
'Oembed' => 'Pingpong\Oembed\Facades\Oembed',
完成。
使用方法
基本用法
$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 with 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
缓存结果。
$info = Oembed::cache($url, $options);
文档
因为此包使用了oscarotero/Embed库,请参阅其文档以获取更多信息。
许可证
此包是开源软件,许可协议为BSD 3-Clause License