定制 codeurs/social-feed 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

codeurs/social-feed

最新稳定版本:1.0.11

Composer 安装命令:

composer require codeurs/social-feed

包简介

Get feeds from different social networks in a unified format

关键字:

README 文档

README

Get feeds from different social networks in a unified format

Install

Use composer: composer require codeurs/social-feed

Features

  • Get the most recent posts of a user
  • Get a specific item based on an ID
  • Implemented media: Twitter, Facebook, Instagram
  • Returns items in simple format
  • Gets information (id, service, thumbnail) on attached video/images from: youtube, vine, instagram, vimeo
  • Get an id from an url of a post

Example

Facebook

$feed = new SocialFeed();

// Input api credentials
$feed->facebook->setCredentials([
  'app_id' => '__',
  'app_secret' => '__'
]);

// Get all recent posts for user 'codeurs.be'
$data = $feed->facebook->getFeed('codeurs.be');
foreach ($data as $item) {
  // ...
}

// Get a single facebook post
$item = $feed->facebook->getItem('646338148755451_704084252980840');

// Get an id or item from a facebook url
$id = $feed->facebook->getIdFromUrl('https://www.facebook.com/_/photos/_/?type=1&theater');
$item = $feed->facebook->getItemFromUrl('https://www.facebook.com/_/photos/_/?type=1&theater');

Output

Output returns the following format (as a php object; printed as json for readability):

{
  "service": "facebook",
  "text": "Example.",
  "link": "https://www.facebook.com/____",
  "id": "_",
  "created": 1428764403,
  "user": {
    "id": "_",
    "image": "https://graph.facebook.com/v2.3/_/picture/",
    "name": "_",
    "handle": null,
    "link": "https://facebook.com/profile.php?id=_"
  },
  "media": {
    "image": "https://graph.facebook.com/_/picture?type=normal",
    "video": null
  }
}

If a video is present, information will be available in media.video:

{
  "image": null,
  "video": {
    "service": "youtube",
    "id": "_",
    "image": "http://img.youtube.com/vi/_/hqdefault.jpg"
  }
}

Credentials

The following credentials are needed depending on the medium:

  • Facebook: app_id, app_secret
  • Twitter: consumer_key, consumer_secret, access_token, access_token_secret
  • Instagram: client_id, client_secret

统计信息

  • 总下载量: 610
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 5
  • Forks: 18
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-17