Download the PHP package kalimeromk/facebook-post without Composer
On this page you can find all versions of the php package kalimeromk/facebook-post. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kalimeromk/facebook-post
More information about kalimeromk/facebook-post
Files in kalimeromk/facebook-post
Package facebook-post
Short Description This package allow to create, update, delete and get posts from facebook page in laravel application
License MIT
Informations about the package facebook-post
Laravel Facebook Page Post
This package allow to create, update, delete and get posts from facebook page in laravel application
Requirements
- PHP >=7.4
Installation
You can install the package via composer:
Configuration
You can publish the configuration file config/facebook.php optionally by using the following command:
Configure .env file
Usage
Get All posts
Create Text post
Create Text post with photo
Create Text post with video
Update post
Delete post
Example Success Response
Example Failure Response
Limitations
- You can update only the text of a post. Image is not updatable.
- Multiple image upload is not supported.
- Video upload is not supported
How to generate access token?
- At first create a business type facebook app. Create app from Facebook Deveoper Panel
- Go to Facebook Graph Api Explorer
- Here you will see three select option:
- Meta App
- User or Page
- Permissions
Meta App: Here you will see all facebook app that you have created. Select your business type app from the dropdown list.User or Page: Here you need to select page access token. Then it will redirect you to your facebook page list. Select your preferred page and give necessary permission.-
Permissions: Please select the following permission from this permission listpages_show_listpages_read_engagementpages_manage_engagementpages_manage_postspages_read_user_content
-
Finally click on the Generate Access Token button and it will generate temporary access token for one hour.
- If you want to make this token as long lived, you need to go Access Token Debugger. Insert the access token and click on the
Debugbutton. Then it will show token information. Scroll down this page and you will seeExtend Access Token. Click on this button and it will generate long lived access token.Then copy the access token and use this asFACEBOOK_ACCESS_TOKEN
Note:
If you want to generate never expiry access token, you need to follow this step:
- Please open an api testing tool like Postman and send a get request by using this url
https://graph.facebook. com/v22.0/{app-scoped-user-id}/accounts?access_token={long-lived-user-access-token}. If you want to generate user access token instead of page access token, just select user access token fromUser or Pagesection that i have mentioned in step 5. - Extend expiry date of this user access token as like as page access token extend method that i have mentioned in step 8.
- Then debug this
long-lived-user-access-tokenand you will getapp-scoped-user-idfrom this debug information. - Finally send get request to this url
https://graph.facebook.com/v22.0/{app-scoped-user-id}/accounts?access_token= {long-lived-user-access-token}. Now You will get never expiry page access token from this request and use this access token asFACEBOOK_ACCESS_TOKEN
License
The MIT License (MIT). Please see License File for more information.