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

Video Upload Example

This example covers uploading & posting a video to a user's timeline with the Facebook SDK for PHP.

Example

Warning: Before you upload, check out the video publishing options & requirements for the specific video endpoint you want to publish to.

The following example will upload a video in chunks using the resumable upload feature added in Graph v2.3.

$fb = new Facebook\Facebook([
  'app_id' => '{app-id}',
  'app_secret' => '{app-secret}',
  'default_graph_version' => 'v10.0',
  ]);

$data = [
  'title' => 'My Foo Video',
  'description' => 'This video is full of foo and bar action.',
];

try {
  $response = $fb->uploadVideo('me', '/path/to/foo_bar.mp4', $data, '{user-access-token}');
} catch(Facebook\Exception\ResponseException $e) {
  // When Graph returns an error
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exception\SDKException $e) {
  // When validation fails or other local issues
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}

echo 'Video ID: ' . $response['video_id'];

See more about the uploadVideo() method.

For versions of Graph before v2.3, videos had to be uploaded in one request.

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

$data = [
  'title' => 'My Foo Video',
  'description' => 'This video is full of foo and bar action.',
  'source' => $fb->videoToUpload('/path/to/foo_bar.mp4'),
];

try {
  $response = $fb->post('/me/videos', $data, 'user-access-token');
} catch(Facebook\Exception\ResponseException $e) {
  // When Graph returns an error
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exception\SDKException $e) {
  // When validation fails or other local issues
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}

$graphNode = $response->getGraphNode();

echo 'Video ID: ' . $graphNode['id'];
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