首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Laravel 5.1 oembed

Laravel 5.1 oembed
EN

Stack Overflow用户
提问于 2016-04-26 16:58:50
回答 1查看 828关注 0票数 0

有什么用于laravel 5.1的oembed包吗?我试过this package,但我得到了

代码语言:javascript
复制
 BadMethodCallException in ServiceProvider.php line 234:
 Call to undefined method [package]
EN

回答 1

Stack Overflow用户

发布于 2016-05-04 23:14:48

这个可以在Laravel 5.2中运行

https://github.com/oscarotero/Embed

将此内容添加到composer

代码语言:javascript
复制
"embed/embed": "^2.6"

然后,您可以在控制器中执行此操作

代码语言:javascript
复制
//Load any url:
      $info = \Embed\Embed::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);
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36860075

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档