Skip to content

PHP SDK

The official HookBridge SDK for PHP provides a simple way to integrate with HookBridge.

Terminal window
composer require hookbridge/hookbridge-php
<?php
require_once 'vendor/autoload.php';
use HookBridge\HookBridge;
$client = new HookBridge('YOUR_API_KEY');
// Create an endpoint
$endpoint = $client->createEndpoint(
url: 'https://your-app.com/webhooks',
description: 'My webhook endpoint'
);
// Send a webhook
$result = $client->send(
endpointId: $endpoint->id,
payload: [
'event' => 'user.created',
'data' => [
'user_id' => '123',
'email' => 'user@example.com',
],
]
);
echo "Message sent: " . $result->messageId . "\n";

Publish the config file:

Terminal window
php artisan vendor:publish --tag=hookbridge-config

Then set your API key in .env:

HOOKBRIDGE_API_KEY=your_api_key

Use the facade:

use HookBridge\Facades\HookBridge;
$result = HookBridge::send(
endpointId: 'ep_abc123',
payload: ['event' => 'test']
);
Personalize Examples

Enter your credentials to populate code examples throughout the docs.