PHPackages                             nazmulhasan/laravel-facebook-post - 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. nazmulhasan/laravel-facebook-post

ActiveLibrary[API Development](/categories/api)

nazmulhasan/laravel-facebook-post
=================================

This package allow to create, update, delete and get posts from facebook page in laravel application

v1.0.2(2y ago)113923[1 issues](https://github.com/Nazmul7989/laravel-facebook-post/issues)MITPHPPHP ^7.2|^7.4|^8.0|^8.1|^8.2|^8.3

Since Mar 23Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Nazmul7989/laravel-facebook-post)[ Packagist](https://packagist.org/packages/nazmulhasan/laravel-facebook-post)[ Docs](https://github.com/Nazmul7989/laravel-facebook-post)[ RSS](/packages/nazmulhasan-laravel-facebook-post/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

Laravel Facebook Page Post
==========================

[](#laravel-facebook-page-post)

[![GitHub Downloads (all assets, all releases)](https://camo.githubusercontent.com/8fa1c2e942b74254d029ab3f5382cf039e90bca570683439b71f071078d1d762/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f4e617a6d756c373938392f6c61726176656c2d66616365626f6f6b2d706f73742f746f74616c3f7374796c653d706c6173746963)](https://camo.githubusercontent.com/8fa1c2e942b74254d029ab3f5382cf039e90bca570683439b71f071078d1d762/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f4e617a6d756c373938392f6c61726176656c2d66616365626f6f6b2d706f73742f746f74616c3f7374796c653d706c6173746963)[![GitHub License](https://camo.githubusercontent.com/34253af8d33450fcbdeef2b3f39152e6376ceda3c316613e2d27c3a2a64180a0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4e617a6d756c373938392f6c61726176656c2d66616365626f6f6b2d706f73743f7374796c653d706c6173746963)](https://camo.githubusercontent.com/34253af8d33450fcbdeef2b3f39152e6376ceda3c316613e2d27c3a2a64180a0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4e617a6d756c373938392f6c61726176656c2d66616365626f6f6b2d706f73743f7374796c653d706c6173746963)[![GitHub forks](https://camo.githubusercontent.com/8d4a7468174300ed80ca1e47685a0c52244dbf8f80a66ccb6e9870776547a4d2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f4e617a6d756c373938392f6c61726176656c2d66616365626f6f6b2d706f73743f7374796c653d706c6173746963)](https://camo.githubusercontent.com/8d4a7468174300ed80ca1e47685a0c52244dbf8f80a66ccb6e9870776547a4d2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f4e617a6d756c373938392f6c61726176656c2d66616365626f6f6b2d706f73743f7374796c653d706c6173746963)[![GitHub Repo stars](https://camo.githubusercontent.com/1c08d0b2716b5d953f6ece0fc6b50d91778a43631ed9632fa92a4709e84ee1f6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f4e617a6d756c373938392f6c61726176656c2d66616365626f6f6b2d706f73743f7374796c653d706c617374696326636f6c6f723d79656c6c6f77)](https://camo.githubusercontent.com/1c08d0b2716b5d953f6ece0fc6b50d91778a43631ed9632fa92a4709e84ee1f6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f4e617a6d756c373938392f6c61726176656c2d66616365626f6f6b2d706f73743f7374796c653d706c617374696326636f6c6f723d79656c6c6f77)

This package allow to create, update, delete and get posts from facebook page in laravel application

Requirements
------------

[](#requirements)

- PHP &gt;=7.2
- Laravel &gt;= 6

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

[](#installation)

You can install the package via composer:

```
composer require nazmulhasan/laravel-facebook-post

```

Configuration
-------------

[](#configuration)

You can publish the configuration file `config/facebook.php` optionally by using the following command:

```
php artisan vendor:publish --provider="NazmulHasan\LaravelFacebookPost\FacebookPostServiceProvider" --tag="config"

```

Configure `.env` file

```
FACEBOOK_PAGE_ID=
FACEBOOK_ACCESS_TOKEN=

```

Usage
-----

[](#usage)

### Get All posts

[](#get-all-posts)

```
use NazmulHasan\LaravelFacebookPost\Facades\FacebookPost;

$response = FacebookPost::getPost();

```

### Create Text post

[](#create-text-post)

```
use NazmulHasan\LaravelFacebookPost\Facades\FacebookPost;

$message = 'Message from laravel application';

$response = FacebookPost::storePost($message);

```

### Create Text post with photo

[](#create-text-post-with-photo)

```
use NazmulHasan\LaravelFacebookPost\Facades\FacebookPost;

$message = 'Message from laravel application'; //message is optional
$url = 'Your image url';

$response = FacebookPost::storePostWithPhoto($url, $message);

```

### Update post

[](#update--post)

```
use NazmulHasan\LaravelFacebookPost\Facades\FacebookPost;

$message = 'Message from laravel application';
$post_id = 'Your post id';

$response = FacebookPost::updatePost($post_id, $message);

```

### Delete post

[](#delete--post)

```
use NazmulHasan\LaravelFacebookPost\Facades\FacebookPost;

$post_id = 'Your post id';

$response = FacebookPost::deletePost($post_id);

```

### Example Success Response

[](#example-success-response)

```
array:4 [
  "status" => "success"
  "status_code" => 200
  "message" => "Post created successfully"
  "post_id" => "103408372435470_395802394384938"
]

```

### Example Failure Response

[](#example-failure-response)

```
array:3 [
  "status" => "fail"
  "status_code" => 422
  "message" => "Message is required"
]

```

Limitations
-----------

[](#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?

[](#how-to-generate-access-token)

1. At first create a business type facebook app. Create app from [Facebook Deveoper Panel](https://developers.facebook.com/)
2. Go to Facebook [Graph Api Explorer](https://developers.facebook.com/tools/explorer/)
3. Here you will see three select option:

- Meta App
- User or Page
- Permissions

4. `Meta App`: Here you will see all facebook app that you have created. Select your business type app from the dropdown list.
5. `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.
6. `Permissions`: Please select the following permission from this permission list

- `pages_show_list`
- `pages_read_engagement`
- `pages_manage_engagement`
- `pages_manage_posts`
- `pages_read_user_content`

7. Finally click on the Generate Access Token button and it will generate temporary access token for one hour.
8. If you want to make this token as long lived, you need to go [Access Token Debugger](https://developers.facebook.com/tools/debug/accesstoken/). Insert the access token and click on the `Debug` button. Then it will show token information. Scroll down this page and you will see `Extend Access Token`. Click on this button and it will generate long lived access token.Then copy the access token and use this as `FACEBOOK_ACCESS_TOKEN`

### Note:

[](#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/v19.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 from `User or Page` section 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-token` and you will get `app-scoped-user-id` from this debug information.
- Finally send get request to this url `https://graph.facebook.com/v19.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 as `FACEBOOK_ACCESS_TOKEN`

If you face any issue or bug, please create an issue by using this link .

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

### See [Facebook Page Api](https://developers.facebook.com/docs/pages-api) for more details

[](#see-facebook-page-api-for-more-details)

### See [Facebook Long Lived Access Token](https://developers.facebook.com/docs/facebook-login/guides/access-tokens/get-long-lived) for more details

[](#see-facebook-long-lived-access-token-for-more-details)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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 ~3 days

Total

3

Last Release

775d ago

### Community

Maintainers

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

---

Top Contributors

[![Nazmul7989](https://avatars.githubusercontent.com/u/72700963?v=4)](https://github.com/Nazmul7989 "Nazmul7989 (13 commits)")

---

Tags

facebook-apifacebook-graph-apifacebook-page-apifacebook-page-feedfacebook-page-postgraph-apilaravellaravel-facebooklaravel-facebook-automatic-postlaravel-facebook-page-apilaravel-facebook-page-postgraph-apifacebook-graph-apifacebook-page-apilaravel-facebook-postlaravel-facebook-page-postlaravel-facebook-page-apilaravel-facebook-automatic-postfabook-apifacebook-page-postfacebook-page-feedfb-page-feedfacebook-page-poster

### Embed Badge

![Health badge](/badges/nazmulhasan-laravel-facebook-post/health.svg)

```
[![Health](https://phpackages.com/badges/nazmulhasan-laravel-facebook-post/health.svg)](https://phpackages.com/packages/nazmulhasan-laravel-facebook-post)
```

###  Alternatives

[jstolpe/instagram-graph-api-php-sdk

Instagram Graph API PHP SDK

13998.4k2](/packages/jstolpe-instagram-graph-api-php-sdk)[esign/laravel-conversions-api

A laravel wrapper package around the Facebook Conversions API

69145.4k](/packages/esign-laravel-conversions-api)[amirsarhang/instagram-php-sdk

It's Instagram Graph SDK for PHP. With this package you can easily make all requests to Instagram Graph API, like Auth and CRUD. Also, we will have more methods regularly.

5210.4k](/packages/amirsarhang-instagram-php-sdk)[didww/didww-api-3-php-sdk

PHP SDK for DIDWW API 3

1218.2k](/packages/didww-didww-api-3-php-sdk)[surface/laravel-webfinger

A Laravel package to create an ActivityPub webfinger.

113.8k](/packages/surface-laravel-webfinger)

PHPackages © 2026

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