1. Go to this page and download the library: Download namest/facebook library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
namest / facebook example snippets
$user = new User(<facebook_id>);
$user->sync(); // Sync all user informations
$user->fetch(); // Get user information from facebook but not sync
$user->get(); // Get user information from local database
$user = User::find(<facebook_id>);
$user = User::findOrSync(<facebook_id>);
$user = User::findOrFetch(<facebook_id>);
$pages = $user->accounts; // Get all user's pages from local database
$user->accounts()->sync(); // Sync user's pages from facebook
$page = $pages[0]; // Return Page instance
$page->sync(); // All object api is the same
$page->posts; // Get all page's posts from local database
$page->posts()->sync(); // Sync page's posts from facebook