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

Facebook\Helper\PageTabHelper

Page tabs are similar to the context to app canvases but are treated slightly differently. Use the FacebookPageTabHelper to obtain an access token or signed request within the context of a page tab.

Usage

The usage of the FacebookPageTabHelper is exactly the same as FacebookCanvasHelper with additional methods to obtain the page data from the signed request.

$fb = new Facebook\Facebook([/* */]);
$pageHelper = $fb->getPageTabHelper();
$signedRequest = $pageHelper->getSignedRequest();

if ($signedRequest) {
  $payload = $signedRequest->getPayload();
  var_dump($payload);
}

If a user has already authenticated your app, you can also obtain an access token.

$fb = new Facebook\Facebook([/* */]);
$pageHelper = $fb->getPageTabHelper();

try {
  $accessToken = $pageHelper->getAccessToken();
} catch(Facebook\Exception\ResponseException $e) {
  // When Graph returns an error
  echo 'Graph returned an error: ' . $e->getMessage();
} catch(Facebook\Exception\SDKException $e) {
  // When validation fails or other local issues
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
}

if (isset($accessToken)) {
  // Logged in.
}

Instance Methods

getPageData()

public string|null getPageData($key, $default = null)

Gets a value from the page property if present.

isAdmin()

public boolean isAdmin()

Returns true is the user has authenticated your app and is an admin of the parent page.

getPageId()

public string|null getPageId()

Returns the ID of the parent page if it can be obtained from the page property in the signed request.

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