2017 © Pedro Peláez
 

library fbbatch

Facebook Batch Requests class wrapper

image

fgrochal/fbbatch

Facebook Batch Requests class wrapper

  • Thursday, August 22, 2013
  • by fgrochal
  • Repository
  • 0 Watchers
  • 2 Stars
  • 16 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

FbBatch

La clase FbBatch te permite hacer uso de Facebook Batch Requests de manera muy sencilla. Que es Facebook Batch Requests?, (*1)

The standard version of the Graph API is designed to make it really easy to get data for an individual object and to browse connections between objects. It also includes a limited ability to retrieve data for a few objects at the same time., (*2)

If your application needs the ability to access significant amounts of data in a single go - or you need to make changes to several objects at once, it is often more efficient to batch your queries rather than make multiple individual HTTP requests., (*3)

To enable this, the Graph API supports Batching. Batching allows you to pass instructions for several operations in a single HTTP request. You can also specify dependencies between related operations (described in a section below). Facebook will process each of your independent operations in parallel and will process your dependent operations sequentially. Once all operations have been completed, a consolidated response will be passed back to you and the HTTP connection will be closed., (*4)

Mas info: https://developers.facebook.com/docs/reference/api/batch/., (*5)

Obtener fuentes con composer

{
    "require": {
      "fgrochal/fbbatch": "dev-master"
    }
}

Ejemplos

Multiples llamadas

 '####', 'secret' => '####'));
$batch = new FbBatch($fb);

$me = $batch->api('/me');
$friends = $batch->api('/me/friends');

$batch->send();

var_dump($me->getResult());
var_dump($friends->getResult());
?>

Multiples llamadas

 '###', 'secret' => '###'));
$batch = new FbBatch($fb);

$pageIds = array('pageId1', 'pageId2', 'pageId3', 'pageId4', 'pageId5', 'pageIdN');
foreach($pageIds as $id) {
  $batch->api('/' . $id);
}

$calls = $batch->send();
foreach($calls as $call) {
  var_dump($call->getResult());
}
?>

Dependencias

 '###', 'secret' => '###'));
$batch = new FbBatch($fb);

$me = $batch->api('/me');
$favoriteAthletes = $batch->api('?ids=' . $me->getParam('favorite_athletes.*.id'));

$batch->send();


var_dump($me->getResult());
var_dump($favoriteAthletes->getResult());
?>

The Versions

22/08 2013

dev-master

9999999-dev https://github.com/fgrochal/fb-batch-requests

Facebook Batch Requests class wrapper

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

api facebook graph batch