Skip to content
This repository has been archived by the owner on May 12, 2022. It is now read-only.
/ social-feed Public archive

Get feeds from different social networks in a unified format

Notifications You must be signed in to change notification settings

codeurs/social-feed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 

Repository files navigation

SocialFeed

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

About

Get feeds from different social networks in a unified format

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages