Download the PHP package lartisan/laravel-facebook-data-deletion without Composer
On this page you can find all versions of the php package lartisan/laravel-facebook-data-deletion. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-facebook-data-deletion
Laravel Facebook Data Deletion
A Laravel package that automates Meta / Facebook Data Deletion Request callbacks through a secure webhook.
It validates and decodes the incoming signed_request, stores a deletion tracking record, dispatches the deletion workflow asynchronously, and exposes a public status page or JSON status endpoint for the confirmation code returned to Meta.
The package is intentionally generic. It does not assume a specific
Usermodel, a fixed Facebook ID column, or a hardcoded deletion strategy. Those details are provided by your application through resolver and deletion handler classes.
Table of Contents
- Requirements
- Installation
- Configuration
- Usage
- Webhook Setup in Meta Dashboard
- The Status Page
- Testing
- Postman / Insomnia Guide
- Security
- Package Architecture
Requirements
- PHP 8.2+
- Laravel 11+
The package is designed to work with Laravel 11 and Laravel 12.
Installation
1. Install the package
2. Publish the configuration file
3. Run the migration
The package stores deletion tracking records in the facebook_data_deletion_requests table.
4. Optionally publish the status page view
Configuration
The package ships with config/facebook-data-deletion.php.
Environment variables
Add your Meta app secret to .env:
You may also optionally configure a dedicated queue connection or queue name:
Default configuration
After publishing the config, open config/facebook-data-deletion.php and point resolver and deletion_handler to the two classes you will create in the next steps:
How the config wires everything together
The package reads these two class names at runtime and binds them to their contracts via Laravel's service container. You never call these classes directly — they are automatically injected by the framework:
resolver→ injected into the package's controller to look up the subject model from the Meta App-Scoped ID.deletion_handler→ injected into theProcessFacebookDataDeletionRequestjob to carry out the actual deletion or anonymization.All you need to do is create the two classes described below and set their fully-qualified class names in this config file.
Configuring the User model and Facebook ID field
The package does not hardcode a user model or a facebook_id column. Instead, you configure a resolver class that knows how to map the Meta App-Scoped ID to the model you want to delete or anonymize.
Step 1 — Create the resolver class
Example: direct facebook_id column on users
Example: social_users.provider + social_users.provider_id
Step 2 — Register it in the config
Configuring the deletion strategy
Your application controls how data is deleted or anonymized by implementing the deletion handler contract.
Step 1 — Create the deletion handler class
Step 2 — Register it in the config
Usage
Once installed, the package registers the callback route by default at:
and the public status route at:
If you prefer a different route structure, update the route section in config/facebook-data-deletion.php.
What Meta sends
Meta submits a POST request containing a signed_request field.
The package:
- validates the signature
- decodes the payload
- extracts
user_id - resolves the target subject through your resolver
- creates a deletion tracking record
- dispatches an async deletion job
- returns the required JSON response:
Webhook Setup in Meta Dashboard
In the Meta App Dashboard, configure the Data Deletion Callback URL to point to your package route.
Step-by-step
- Open your Meta app.
- Go to App Dashboard.
- Open the Data Deletion Request or Data Deletion Callback section.
- Set the callback URL to your public HTTPS endpoint.
- Save the changes.
Example callback URL
Local testing with a tunnel
Meta cannot call a local .test domain directly. For local integration testing, expose your app through a public tunnel such as ngrok or cloudflared.
Example:
The Status Page
The URL returned to Meta includes a confirmation code and points to the status route.
Example:
By default:
- browser requests render an HTML confirmation page
- requests with
Accept: application/jsonreceive structured JSON
Example JSON status response:
Testing
Generate a valid signed_request in Tinker / Tinkerwell
Use the following PHP snippet to generate a Meta-compatible signed_request for Postman, Insomnia, or cURL testing:
Test with cURL
Run the package test suite
From the package directory:
Postman / Insomnia Guide
1. Create a POST request
Use:
2. Set headers
3. Set the JSON body
4. Expected response
5. Check the status endpoint
Use the returned url directly in Postman, Insomnia, or a browser.
If you want JSON instead of HTML, send:
Security
The package validates the incoming Meta signature using HMAC-SHA256 before any deletion logic is executed.
Security notes:
- the webhook request is rejected if
signed_requestis malformed - the payload is rejected if the algorithm is not
HMAC-SHA256 - the callback is rejected if the computed signature does not match
- the route should not be protected by CSRF middleware
By default the package uses the api middleware group, which is the recommended setup for webhook endpoints in Laravel applications.
If you move the route under web middleware, make sure to exclude it from CSRF protection.
Package Architecture
The package exposes two extension points:
Lartisan\FacebookDataDeletion\Contracts\ResolvesFacebookDeletionSubjectLartisan\FacebookDataDeletion\Contracts\DeletesFacebookDeletionSubjectData
This lets the host application decide:
- which model is associated with the Meta App-Scoped ID
- where the Facebook identifier is stored
- whether deletion means hard delete, soft delete, anonymization, or a broader cleanup process
License
This package is open-sourced software licensed under the MIT license.
All versions of laravel-facebook-data-deletion with dependencies
illuminate/contracts Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/http Version ^11.0|^12.0|^13.0
illuminate/queue Version ^11.0|^12.0|^13.0
illuminate/routing Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
illuminate/view Version ^11.0|^12.0|^13.0