Download the PHP package xmhafiz/fb-page-feed without Composer
On this page you can find all versions of the php package xmhafiz/fb-page-feed. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package fb-page-feed
Get Facebook Page Feed
It is simple wrapper class written in php to fetch posts from certain Facebook page.
Currently I am using Facebook graph API with cool guzzle and dotenv
Tested in PHP 7.0, 7.1, 7.4, 8.0
Requirement
- PHP 7.0+
Installation
Step 1: Getting Facebook App
- Go to Facebook developer website
- Click "Add a New App" and fill in details
- On your Dashboard, get the "App ID" and "App Secret"
- Yeah, you are ready to code
Step 2: Install from composer
Alternatively, you can specify as a dependency in your project's existing composer.json file
Usage
After installing, you need to require Composer's autoloader and add your code.
Default (maximum post is 100)
Set Module
Custom Maximum Post Shown
Filter By Keyword
Change Request Field
To get owner's fb page feed using userAccessToken
Details to get userAccessToken
can refer here.
Code Example
Change the $fbSecretKey
and $fbAppId
based on the "App ID" and "App Secret" in Step 1
Using ENV
Then, Just
Method
Method | Param | Description |
---|---|---|
setAppId | String |
FB Application ID (Default is in .env) |
setSecretKey | String |
FB Application Secret ID (Default is in .env) |
setCredential | String, String |
Set Both Secret and App Id (Default is in .env) |
fields | String |
List of Attributes (Default : id,message,created_time,from,permalink_url,full_picture ) |
setPage | String |
Set Page Name (Default is in .env) |
findKeyword | String | Array |
Filter String by certain Keywords |
feedLimit | Integer |
Set result count limit |
Result
You should getting data similarly like below:
Notes
To use 'Page Public Content Access', your use of this endpoint must be reviewed and approved by Facebook. To submit this 'Page Public Content Access' feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review.
To use with dotenv
- Look at example code
- copy the
env.example
file to.env
and make sure fill all the required environment variable (FB_SECRET_KEY
,FB_APP_ID
,FB_PAGENAME
)
License
Licensed under the MIT license