terpise/laravel-webhook is a Laravel package for laravel webhook.
It currently has 0 GitHub stars and 19 downloads on Packagist (latest version 1.0.9).
Install it with composer require terpise/laravel-webhook.
Discover more Laravel packages by terpise
or browse all Laravel packages to compare alternatives.
Last updated
A webhook is a way for an app to provide information to another app about a particular event. The way the two apps communicate is with a simple HTTP request.
You can install the package via composer:
composer require terpise/laravel-webhook
You can publish the config file with:
php artisan vendor:publish --tag=webhook-config
You can publish the migrations file with:
php artisan vendor:publish --tag=webhook-migrations
Run migrations:
php artisan migrate
You can make client with:
php artisan webhook:make
php artisan queue:work
Setup callback:
Route::get('callback', [WebhookClientController::class, 'verify'])->middleware(VerifyToken::class);
Route::post('callback', [WebhookClientController::class, 'callback'])->middleware(VerifyToken::class);
// verify use callback authentication when registering
// callback method you can get data from webhook
// middleware for checking the authenticity of the callback, use 'verify_token'
public function verify(Request $request)
{
return new Response(['challenge' => $request->get('challenge')]);
}
Create subscribe:
$ curl -X POST https://www.domain.com/webhooks/subscribe \
-F client_id=10 \
-F client_secret=7b2946535949ae70f015d696d8ac602830ece412 \
-F callback_url=https://www.domain-client.com/callback \
-F verify_token=5359435949ae70f015d694656d8ac6
View subscribe:
$ curl -X GET https://www.domain.com/webhooks/subscribe \
-F client_id=10 \
-F client_secret=7b2946535949ae70f015d696d8ac602830ece412
Unsubscribe:
$ curl -X POST https://www.domain.com/webhooks/unsubscribe \
-F client_id=10 \
-F client_secret=7b2946535949ae70f015d696d8ac602830ece412
WebhookEvent::dispatch([
"event_time" => now(),
"event_type" => 'create',
"object_id" => 888888,
"object_type" => "users",
]);
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.