Skip to content

Instantly share code, notes, and snippets.

@niraj-shah
Last active August 29, 2015 14:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save niraj-shah/e56a6e383248a4029437 to your computer and use it in GitHub Desktop.
Save niraj-shah/e56a6e383248a4029437 to your computer and use it in GitHub Desktop.
Example of chaining using Facebook PHP SDK 4.0.0
<?php
// turn this:
$request = new FacebookRequest( $session, 'GET', '/me' );
$response = $request->execute();
$graphObject = $response->getGraphObject();
// into this:
$graphObject = (new FacebookRequest( $session, 'GET', '/me' ))->execute()->getGraphObject()->asArray();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment