PHP code example of panelis-php / webhook

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

    

panelis-php / webhook example snippets


return [

    'prefix' => 'webhook',

    'vendors' => [

        'ping' => [
            'handler' => App\Webhook\PingWebhook::class,
        ],

    ],

];



namespace App\Webhook;

use Illuminate\Http\Request;
use Panelis\Webhook\Contracts\Webhook;

class PingWebhook implements Webhook
{
    public function validate(Request $request): void
    {
        //
    }

    public function handle(Request $request): mixed
    {
        return response()->json([
            'message' => 'pong',
        ]);
    }
}

'vendors' => [

    'ping' => [
        'handler' => App\Webhook\PingWebhook::class,
        'store' => true,
    ],

],
bash
composer 
bash
php artisan vendor:publish --tag=webhook-config
bash
php artisan vendor:publish --tag=webhook-migrations
bash
php artisan migrate
text
POST /webhook/ping