PHP code example of bencoderus / laravel-webhook

1. Go to this page and download the library: Download bencoderus/laravel-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/ */

    

bencoderus / laravel-webhook example snippets


public function data(): array
    {
        return [
            'status' => $this->status,
            'amount' => $this->amount,
            'currency' => 'USD',
        ];
    }

$transaction = Transaction::first();

$webhook = new PaymentWebhook($transaction);
$webhook->url('https://httpbin.com')->send();

$transaction = Transaction::first();

$webhook = new PaymentWebhook($transaction);
$webhook->url('https://httpbin.com')
        ->withSignature('x-key', 'value_to_hash')
        ->send();

$transaction = Transaction::first();

$webhook = new PaymentWebhook($transaction);
$webhook->url('https://httpbin.com')->send(false);
 php
php artisan webhook:install
bash
php artisan migrate
bash
php artisan make:webhook PaymentWebhook