SDK API Reference

Below is the API reference for the Facebook SDK for PHP.

Core API

These classes are at the core of the Facebook SDK for PHP.

Class nameDescription
Facebook\FacebookThe main service object that helps tie all the SDK components together.
Facebook\FacebookAppAn entity that represents a Facebook app and is required to send requests to Graph.

Authentication

These classes facilitate authenticating a Facebook user with OAuth 2.0.

Class nameDescription
Facebook\Helpers\FacebookRedirectLoginHelperAn OAuth 2.0 service to obtain a user access token from a redirect using a “Log in with Facebook” link.
Facebook\Authentication\AccessTokenAn entity that represents an access token.
Facebook\Authentication\AccessTokenMetadataAn entity that represents metadata from an access token.
Facebook\Authentication\OAuth2ClientAn OAuth 2.0 client that sends and receives HTTP requests related to user authentication.

Requests and Responses

These classes are used in a Graph API request/response cycle.

Class nameDescription
Facebook\FacebookRequestAn entity that represents an HTTP request to be sent to Graph.
Facebook\FacebookResponseAn entity that represents an HTTP response from Graph.
Facebook\FacebookBatchRequestAn entity that represents an HTTP batch request to be sent to Graph.
Facebook\FacebookBatchResponseAn entity that represents an HTTP response from Graph after sending a batch request.
Facebook\FacebookClientA service object that sends HTTP requests and receives HTTP responses to and from the Graph API.

Signed Requests

Classes to help obtain and manage signed requests.

Class nameDescription
Facebook\Helpers\FacebookJavaScriptHelperUsed to obtain an access token or signed request from the cookie set by the JavaScript SDK.
Facebook\Helpers\FacebookCanvasHelperUsed to obtain an access token or signed request from within the context of an app canvas.
Facebook\Helpers\FacebookPageTabHelperUsed to obtain an access token or signed request from within the context of a page tab.
Facebook\SignedRequestAn entity that represents a signed request.

Core Exceptions

These are the core exceptions that the SDK will throw when an error occurs.

Class nameDescription
Facebook\Exceptions\FacebookSDKExceptionThe base exception to all exceptions thrown by the SDK. Thrown when there is a non-Graph-response-related error.
Facebook\Exceptions\FacebookResponseExceptionThe base exception to all Graph error responses. This exception is never thrown directly.

Graph Nodes and Edges

Graph nodes are collections that represent nodes returned by the Graph API. And Graph edges are a collection of nodes returned from an edge on the Graph API.

Class nameDescription
Facebook\GraphNodes\GraphNodeThe base collection object that represents a generic node.
Facebook\GraphNodes\GraphEdgeA collection of GraphNode’s with special methods to help paginate over the edge.
Facebook\GraphNodes\GraphAchievementA collection that represents an Achievement node.
Facebook\GraphNodes\GraphAlbumA collection that represents an Album node.
Facebook\GraphNodes\GraphLocationA collection that represents a Location node.
Facebook\GraphNodes\GraphPageA collection that represents a Page node.
Facebook\GraphNodes\GraphPictureA collection that represents a Picture node.
Facebook\GraphNodes\GraphUserA collection that represents a User node.

File Uploads

These are entities that represent files to be uploaded with a Graph request.

Class nameDescription
Facebook\FileUpload\FacebookFileRepresents a generic file to be uploaded to the Graph API.
Facebook\FileUpload\FacebookVideoRepresents a video file to be uploaded to the Graph API.

Extensibility

You can overwrite certain functionality of the SDK by coding to an interface and injecting an instance of your custom functionality.

Interface nameDescription
Facebook\HttpClients\ FacebookHttpClientInterfaceAn interface to code your own HTTP client implementation.
Facebook\Http\GraphRawResponseAn entity that is returned from an instance of a FacebookHttpClientInterface that represents a raw HTTP response from the Graph API.
Facebook\PersistentData\PersistentDataInterfaceAn interface to code your own persistent data storage implementation.
Facebook\Url\UrlDetectionInterfaceAn interface to code your own URL detection logic.
Facebook\PseudoRandomString\ PseudoRandomStringGeneratorInterfaceAn interface to code your own cryptographically secure pseudo-random string generator.
Share this post
[social_warfare]
Post Links by Graph API Example
JavaScript SDK Basics

Get industry recognized certification – Contact us

keyboard_arrow_up