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

FacebookClient service class for the Facebook SDK for PHP

The Facebook\Client service class juggles the dependencies needed to make requests to the Graph API.

Facebook\Client

You most likely won't be working with the Facebook\Client service directly if you're using the Facebook\Facebook super service class, but if you have a highly customized environment, you might need to send requests with an instance of Facebook\Client.

You can grab an instance of a Facebook\Client service, from the Facebook\Facebook super service class.

$fb = new Facebook\Facebook([/* */]);
$fbClient = $fb->getClient();

Alternatively you could instantiate a new Facebook\Client service directly.

$fbClient = new Facebook\Client($httpClientHandler, $enableBeta = false);

The Graph API has a number of different base URL's based on what request you want to send. For example, if you wanted to send requests to the beta version of Graph, you'd need to send requests to https://graph.beta.facebook.com instead https://graph.facebook.com. And if you wanted to upload a video, that request would need to be sent to https://graph-video.facebook.com.

The Facebook\Client service takes the guess-work out of managing those base URL's by automatically sending your requests to the proper URL.

Instance Methods

getHttpClientHandler()

public Facebook\HttpClients\HttpClientInterface getHttpClientHandler()

Returns the instance of Facebook\HttpClients\HttpClientInterface that the service is using.

setHttpClientHandler()

public setHttpClientHandler(Facebook\HttpClients\HttpClientInterface $client)

If you've coded your own HTTP client to the Facebook\HttpClients\HttpClientInterface, you can inject it into the service using this method.

enableBetaMode()

public enableBetaMode(boolean $enable = true)

Tells the service to send requests to the beta URL's which include https://graph.beta.facebook.com and https://graph-video.beta.facebook.com.

sendRequest()

public Facebook\Response sendRequest(Facebook\Request $request)

Sends a non-batch request to Graph.

Takes a Facebook\Request and sends it to the Graph API in the proper application/x-www-form-urlencoded or multipart/form-data encoded format.

Returns the response from Graph in the form of a Facebook\Response.

If there was an error processing the request before sending, a Facebook\Exception\SDKException will be thrown.

If an error response from Graph was returned, a Facebook\Exception\ResponseException will be thrown.

sendBatchRequest()

public Facebook\BatchResponse sendBatchRequest(Facebook\BatchRequest $batchRequest)

Sends a batch request to Graph.

Takes a Facebook\BatchRequest and sends it to the Graph API in the proper application/x-www-form-urlencoded or multipart/form-data encoded format.

Returns the response from Graph in the form of a Facebook\BatchResponse.

If there was an error processing the request before sending, a Facebook\Exception\SDKException will be thrown.

If an error response from Graph was returned, a Facebook\Exception\ResponseException will be thrown.

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