Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Facebook Graph Sdk Laravel Package

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.

View on GitHub
Deep Wiki
Context7

FacebookResponse for the Facebook SDK for PHP

Represents a response from the Graph API.

Facebook\FacebookResponse

After sending a request to the Graph API, the response will be returned in the form of a Facebook\FacebookResponse entity.

Usage:

$fb = new Facebook\Facebook(/* . . . */);

// Send the request to Graph
try {
  $response = $fb->get('/me');
} catch(Facebook\Exception\FacebookResponseException $e) {
  // When Graph returns an error
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exception\FacebookSDKException $e) {
  // When validation fails or other local issues
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}

var_dump($response);
// class Facebook\FacebookResponse . . .

Instance Methods

getRequest()

public Facebook\FacebookRequest getRequest()

Returns the original Facebook\FacebookRequest entity that was used to solicit this response.

getAccessToken()

public string getAccessToken()

Returns the access token that was used for the original request in the form of a string.

getApplication()

public Facebook\Application getApplication()

Returns the Facebook\Application entity that was used with the original request.

getHttpStatusCode()

public int getHttpStatusCode()

Returns the HTTP response code for this response.

getHeaders()

public array getHeaders()

Returns the response headers that were returned.

getBody()

public string getBody()

Returns the raw, unparsed body of the response as a string.

getDecodedBody()

public array getDecodedBody()

Returns the parsed body of the response as an array.

getAppSecretProof()

public string getAppSecretProof()

Returns the original app secret proof that was used with the original request.

getETag()

public string getETag()

Returns the ETag response header if it exists. If the header does not exist in the response headers, null will be returned instead.

getGraphVersion()

public string getGraphVersion()

Returns the Graph version that was used by returning the value from the Facebook-API-Version response header if it exists. If the header does not exist in the response headers, null will be returned instead.

isError()

public boolean isError()

If the Graph API returned an error response isError() will return true. If a successful response was returned, isError() will return false.

throwException()

public throwException()

Throws the Facebook\Exception\FacebookResponseException that was generated by an error response from Graph.

getThrownException()

public Facebook\Exception\FacebookResponseException getThrownException()

Returns the Facebook\Exception\FacebookResponseException that was generated by an error response from Graph. This is mainly useful for dealing with responses to batch requests.

getGraphNode()

public Facebook\GraphNode\GraphNode getGraphNode()

Returns the response data in the form of a Facebook\GraphNode\GraphNode collection.

getGraphAlbum()

public Facebook\GraphNode\GraphAlbum getGraphAlbum()

Returns the response data in the form of a Facebook\GraphNode\GraphAlbum collection.

getGraphPage()

public Facebook\GraphNode\GraphPage getGraphPage()

Returns the response data in the form of a Facebook\GraphNode\GraphPage collection.

getGraphSessionInfo()

public Facebook\GraphNode\GraphSessionInfo getGraphSessionInfo()

Returns the response data in the form of a Facebook\GraphNode\GraphSessionInfo collection.

getGraphUser()

public Facebook\GraphNode\GraphUser getGraphUser()

Returns the response data in the form of a Facebook\GraphNode\GraphUser collection.

getGraphEdge()

public Facebook\GraphNode\GraphEdge getGraphEdge(
	string|null $subclassName,
	boolean $auto_prefix)

Returns the response data in the form of a Facebook\GraphNode\GraphEdge collection.

$subclassName The Facebook\GraphNode\GraphNode subclass to cast list items to. If none is provided, default is Facebook\GraphNode\GraphNode.

$auto_prefix Toggle to auto-prefix the subclass name. If none is provided, default is true.

$res = $fb->get('/{facebook-page}/events', '{access-token}');
$events = $res->getGraphEdge("GraphEvent");
foreach ($events as $event) {
	// . . .
}
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
craftcms/url-validator
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony