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

The persistent data handler interface for the Facebook SDK for PHP

The persistent data handler interface stores values in a persistent data store. By default the SDK for PHP uses native PHP sessions to store the persistent data. You can overwrite this behavior by coding to the Facebook\PersistentData\PersistentDataInterface.

Facebook\PersistentData\PersistentDataInterface

If you're using a web framework that handles persistent data for you, you might want to code a custom persistent data handler to ensure that your persistent storage is being handled consistently.

For example if you are using Laravel, a custom handler might look like this:

use Facebook\PersistentData\PersistentDataInterface;

class MyLaravelPersistentDataHandler implements PersistentDataInterface
{
  /**
   * [@var](https://github.com/var) string Prefix to use for session variables.
   */
  protected $sessionPrefix = 'FBRLH_';

  /**
   * [@inheritdoc](https://github.com/inheritdoc)
   */
  public function get($key)
  {
    return \Session::get($this->sessionPrefix . $key);
  }

  /**
   * [@inheritdoc](https://github.com/inheritdoc)
   */
  public function set($key, $value)
  {
    \Session::put($this->sessionPrefix . $key, $value);
  }
}

To enable your custom persistent data handler implementation in the SDK, you can set an instance of the handler to the persistent_data_handler config of the Facebook\Facebook super service.

$fb = new Facebook\Facebook([
  // . . .
  'persistent_data_handler' => new MyLaravelPersistentDataHandler(),
  // . . .
  ]);

Alternatively, if you're working with the Facebook\Helper\RedirectLoginHelper directly, you can inject your custom handler via the constructor.

use Facebook\Helper\RedirectLoginHelper;

$myPersistentDataHandler = new MyLaravelPersistentDataHandler();
$helper = new FacebookRedirectLoginHelper($fbApp, $myPersistentDataHandler);

Method Reference

get()

public mixed get(string $key)

Returns a value from the persistent data store or null if the value does not exist.

set()

public void set(string $key, mixed $value)

Sets a value to the persistent data store.

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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky