有没有适用于 laravel 5.1 的嵌入包。我已经尝试过这个软件包,但我得到了
BadMethodCallException in ServiceProvider.php line 234:
Call to undefined method [package]
这个在 Laravel 5.2 中工作
https://github.com/oscarotero/Embed
将此添加到作曲家
"embed/embed": "^2.6"
然后,您可以在控制器中执行此操作
//Load any url:
$info = EmbedEmbed::create('http://www.roadandtrack.com/new-cars/future-cars/news/a29059/volkswagen-golf-gti-heartbeat-concept/');
//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->tags; //The page keywords (tags)
$info->images; //List of all images found in the page
$info->image; //The image choosen as main image
$info->imageWidth; //The width 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
$info->publishedDate; //The (video/article/image/whatever) published date
dd($info);