martin1982/facebook-graph-sdk
PHP 7.4+ Facebook Graph SDK (v7) for accessing the Facebook Platform. Install via Composer, initialize with app ID/secret, and make Graph API requests with built-in helpers for login flows and access tokens. Includes docs and PHPUnit tests.
Below is the API reference for the Facebook SDK for PHP.
These classes are at the core of the Facebook SDK for PHP.
| Class name | Description |
|---|---|
Facebook\Facebook |
The main service object that helps tie all the SDK components together. |
Facebook\Application |
An entity that represents a Facebook app and is required to send requests to Graph. |
These classes facilitate authenticating a Facebook user with OAuth 2.0.
| Class name | Description |
|---|---|
Facebook\Helper\RedirectLoginHelper |
An OAuth 2.0 service to obtain a user access token from a redirect using a "Log in with Facebook" link. |
Facebook\Authentication\AccessToken |
An entity that represents an access token. |
Facebook\Authentication\AccessTokenMetadata |
An entity that represents metadata from an access token. |
Facebook\Authentication\OAuth2Client |
An OAuth 2.0 client that sends and receives HTTP requests related to user authentication. |
These classes are used in a Graph API request/response cycle.
| Class name | Description |
|---|---|
Facebook\Request |
An entity that represents an HTTP request to be sent to Graph. |
Facebook\Response |
An entity that represents an HTTP response from Graph. |
Facebook\BatchRequest |
An entity that represents an HTTP batch request to be sent to Graph. |
Facebook\BatchResponse |
An entity that represents an HTTP response from Graph after sending a batch request. |
Facebook\Client |
A service object that sends HTTP requests and receives HTTP responses to and from the Graph API. |
Classes to help obtain and manage signed requests.
| Class name | Description |
|---|---|
Facebook\Helper\JavaScriptHelper |
Used to obtain an access token or signed request from the cookie set by the JavaScript SDK. |
Facebook\Helper\CanvasHelper |
Used to obtain an access token or signed request from within the context of an app canvas. |
Facebook\Helper\PageTabHelper |
Used to obtain an access token or signed request from within the context of a page tab. |
Facebook\SignedRequest |
An entity that represents a signed request. |
These are the core exceptions that the SDK will throw when an error occurs.
| Class name | Description |
|---|---|
Facebook\Exception\SDKException |
The base exception to all exceptions thrown by the SDK. Thrown when there is a non-Graph-response-related error. |
Facebook\Exception\ResponseException |
The base exception to all Graph error responses. This exception is never thrown directly. |
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 name | Description |
|---|---|
Facebook\GraphNode\GraphNode |
The base collection object that represents a generic node. |
Facebook\GraphNode\GraphEdge |
A collection of GraphNode's with special methods to help paginate over the edge. |
Facebook\GraphNode\GraphAchievement |
A collection that represents an Achievement node. |
Facebook\GraphNode\GraphAlbum |
A collection that represents an Album node. |
Facebook\GraphNode\GraphLocation |
A collection that represents a Location node. |
Facebook\GraphNode\GraphPage |
A collection that represents a Page node. |
Facebook\GraphNode\GraphPicture |
A collection that represents a Picture node. |
Facebook\GraphNode\GraphUser |
A collection that represents a User node. |
These are entities that represent files to be uploaded with a Graph request.
| Class name | Description |
|---|---|
Facebook\FileUpload\File |
Represents a generic file to be uploaded to the Graph API. |
Facebook\FileUpload\Video |
Represents a video file to be uploaded to the Graph API. |
You can overwrite certain functionality of the SDK by coding to an interface and injecting an instance of your custom functionality.
| Interface name | Description |
|---|---|
Facebook\HttpClients\ FacebookHttpClientInterface |
An interface to code your own HTTP client implementation. |
Facebook\Http\GraphRawResponse |
An entity that is returned from an instance of a FacebookHttpClientInterface that represents a raw HTTP response from the Graph API. |
Facebook\PersistentData\PersistentDataInterface |
An interface to code your own persistent data storage implementation. |
Facebook\Url\UrlDetectionInterface |
An interface to code your own URL detection logic. |
How can I help you explore Laravel packages today?