PHPackages                             kerigansolutions/facebookfeed - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. kerigansolutions/facebookfeed

ActiveLibrary[API Development](/categories/api)

kerigansolutions/facebookfeed
=============================

0.17(8y ago)11022[1 issues](https://github.com/kerigansolutions/facebookfeed/issues)MITPHP

Since Nov 8Pushed 8y ago1 watchersCompare

[ Source](https://github.com/kerigansolutions/facebookfeed)[ Packagist](https://packagist.org/packages/kerigansolutions/facebookfeed)[ RSS](/packages/kerigansolutions-facebookfeed/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (2)Versions (20)Used By (0)

KMA WordPress Facebook Feed
===========================

[](#kma-wordpress-facebook-feed)

Easily pull posts and events into your WordPress Site from a Facebook page that you manage.

Installation
------------

[](#installation)

`composer require kerigansolutions/facebookfeed`

Setup
-----

[](#setup)

### Get your Facebook Page ID and Access token

[](#get-your-facebook-page-id-and-access-token)

- Facebook Page ID

    - Open your Facebook Page
    - Click "About"
    - Scroll down to the "More Info" section
    - Under Page ID, you will find your page ID
- App Access Token

    - Create a new app in the [Facebook Developer Console](https://developers.facebook.com/apps/)
    - Use the [Access Token tool](https://developers.facebook.com/tools/accesstoken/) to retrieve your App Access Token
- Add your Facebook Page ID and Access Token to `wp-config.php`

```
define('FACEBOOK_PAGE_ID', 'YOUR FACEBOOK PAGE ID HERE');
define('FACEBOOK_ACCESS_TOKEN', 'YOUR FACEBOOK TOKEN HERE');

```

Quick Start
-----------

[](#quick-start)

```
$facebookFeed  = new KeriganSolutions\FacebookFeed\FacebookFeed();
$numberOfPosts = 5;

$results = $facebookFeed->fetch($numberOfPosts);

echo '',print_r($results),'';
```

Pagination
----------

[](#pagination)

This package uses the default cursor-based pagination that is returned by the Facebook Graph API. Let's take a look at how to implement this in our WordPress site:

### Make the API call and retrieve the results:

[](#make-the-api-call-and-retrieve-the-results)

```
$facebookFeed  = new KeriganSolutions\FacebookFeed\FacebookFeed();
$numberOfPosts = 5;

$results = $facebookFeed->fetch($numberOfPosts);
```

We've covered this already. So far, so good. Let's look at the returned data:

```
stdClass Object
(
    [posts] => Array
        (
            [0] => stdClass Object
                (
                    [permalink_url] => https://www.facebook.com/XXXXXXXX/posts/1989865411030718
                    [full_picture] => https://scontent.xx.fbcdn.net/v/t31.0-8/s720x720/24958917_1989865411030718_66...
                    [object_id] => 1989865411030718
                    [type] => photo
                    [status_type] => added_photos
                    [created_time] => 2017-12-10T22:51:24+0000
                    [link] => https://www.facebook.com/XXXXXX/photos/a.1989861894364403.1...
                    [attachments] => stdClass Object
                        (
                            [data] => Array
                                (
                                    [0] => stdClass Object
                                        (
                                            [target] => stdClass Object
                                                (
                                                    [url] => https://www.facebook.com/media/set/?set=ms.c.eJxNV1...
                                                )

                                            [media] => stdClass Object
                                                (
                                                    [image] => stdClass Object
                                                        (
                                                            [height] => 478
                                                            [src] => https://scontent.xx.fbcdn.net/v/t31.0-8/s720x72..
                                                            [width] => 720
                                                        )

                                                )

                                        )

                                )

                        )

                    [id] => 167644949919449_1989865411030718
                )

        )

    [paging] => stdClass Object
        (
            [cursors] => stdClass Object
                (
                    [before] => Q2c4U1pXNTBYM0YxWlhKNVgzTjBiM0o1WDJ....
                    [after] => Q2c4U1pXNTBYM0YxWlhKNVgzTjBiM0o1WDJs...
                )

            [next] => https://graph.facebook.com/v2.11/167644949919449/posts?access_token=3119470492897...
        )

)

```

From the [Facebook Graph API docs](https://developers.facebook.com/docs/graph-api/using-graph-api):

> `before` : This is the cursor that points to the start of the page of data that has been returned.
>
> `after` : This is the cursor that points to the end of the page of data that has been returned.
>
> `next` : The Graph API endpoint that will return the next page of data. If not included, this is the last page of data. Due to how pagination works with visibility and privacy, it is possible that a page may be empty but contain a 'next' paging link. Stop paging when the 'next' link no longer appears.
>
> `previous` : The Graph API endpoint that will return the previous page of data. If not included, this is the first page of data.

### What does this mean?

[](#what-does-this-mean)

Now we know where the data starts and stops so we can get our next five results by passing some new arguments to the `fetch` function. Observe:

```
$facebookFeed  = new KeriganSolutions\FacebookFeed\FacebookFeed();
$numberOfPosts = 5;
$before        = null;
$after         = 'Q2c4U1pXNTBYM0YxWlhKNVgzTjBiM0o1WDJs...';

$results = $facebookFeed->fetch($numberOfPosts, $before, $after);

echo '',print_r($results),'';
```

*NOTE: Cursors can change frequently and without warning from Facebook. DO NOT STORE cursors. Grab them dynamically and pass them to the next page using GET variables or another similar method*

Embedded videos
---------------

[](#embedded-videos)

In order to handle embedding videos from your Facebook statuses on to your WordPress page, you'll need to conditionally check if the `post->type` is `video`, set up a standard iframe and pass the returned `link` value for the post into the `src` attribute. The package currently handles embedded Facebook, Vimeo, and Youtube videos.

Events
------

[](#events)

Events are handled similarly to posts.

```
$fb     = new KeriganSolutions\FacebookFeed\FacebookEvents();
$before = null;
$after  = null;
$events = $fb->fetch(10, $before, $after);

echo '',print_r($events),'';
```

Docs are a work in progress and a more in-depth guide will be coming soon.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~6 days

Recently: every ~21 days

Total

18

Last Release

3002d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ffd5089a51c3dca8ee74e454430da37036d23e2b298ce9b6df863dfe2741ca75?d=identicon)[daron53](/maintainers/daron53)

![](https://www.gravatar.com/avatar/72e6719e07dde4f1374bbc190f8677a91978964401bb4f47cc8c1682e66b6cb3?d=identicon)[kma](/maintainers/kma)

---

Top Contributors

[![doomtickle](https://avatars.githubusercontent.com/u/18637267?v=4)](https://github.com/doomtickle "doomtickle (52 commits)")

---

Tags

composer-libraryfacebook-apifacebook-graph-apiphpphp7wordpresswordpress-development

### Embed Badge

![Health badge](/badges/kerigansolutions-facebookfeed/health.svg)

```
[![Health](https://phpackages.com/badges/kerigansolutions-facebookfeed/health.svg)](https://phpackages.com/packages/kerigansolutions-facebookfeed)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.2M720](/packages/statamic-cms)[ashallendesign/laravel-exchange-rates

A wrapper package for interacting with the exchangeratesapi.io API.

485677.8k](/packages/ashallendesign-laravel-exchange-rates)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1221.1k](/packages/codebar-ag-laravel-docuware)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
