PHP code example of marshmallow / laravel-facebook-webhook

1. Go to this page and download the library: Download marshmallow/laravel-facebook-webhook library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

marshmallow / laravel-facebook-webhook example snippets


'name' => 'facebook-lead',
'signing_secret' => env('FACEBOOK_CLIENT_SECRET'),
'signature_header_name' => 'X-Hub-Signature',
'signature_validator' => \Marshmallow\LaravelFacebookWebhook\SignatureValidator\FacebookSignatureValidator::class,
'process_webhook_job' => \Marshmallow\LaravelFacebookWebhook\Jobs\ProcessFacebookLeadWebhookJob::class,

'facebook' => [
    'client_id' => env('FACEBOOK_CLIENT_ID'),
    'client_secret' => env('FACEBOOK_CLIENT_SECRET'),
    'redirect' => env('FACEBOOK_REDIRECT_URI'),
],

use Marshmallow\LaravelFacebookWebhook\Jobs\ProcessFacebookLeadJob as MarshmallowWebhookJob;

class ProcessFacebookDataJob extends MarshmallowWebhookJob
{
    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        ray($this->webhookData);
    }
}

'process_facebook_webhook_job' => \App\Jobs\ProcessFacebookDataJob::class,
bash
php artisan vendor:publish --provider="Spatie\WebhookClient\WebhookClientServiceProvider" --tag="migrations"
bash
php artisan vendor:publish --tag="laravel-facebook-webhook-config"
bash
php artisan vendor:publish --tag="laravel-facebook-webhook-migrations"
php artisan migrate
bash
php artisan vendor:publish --provider="Marshmallow\LaravelFacebookWebhook\LaravelFacebookWebhookServiceProvider"
bash
php artisan marshmallow:setup-facebook