HookSniff PHP SDK

June 3, 2026 ยท View on GitHub

Latest Version Total Downloads License PHP Version

Official PHP SDK for the HookSniff webhook delivery platform.

Installation

composer require hooksniff/hooksniff

Quick Start

require 'vendor/autoload.php';

use HookSniff\HookSniff;
use HookSniff\Models\MessageIn;
use HookSniff\Models\EndpointIn;

// Initialize client
$client = new HookSniff("hs_xxx");

// Create an endpoint
$endpoint = $client->endpoint->create(
    new EndpointIn("https://example.com/webhook")
);

// Send a webhook
$message = $client->message->create(
    new MessageIn("user.created", ["email" => "user@example.com"])
);

// List deliveries
$attempts = $client->messageAttempt->listByEndpoint($endpoint->id);

Webhook Verification

use HookSniff\Webhook;

$wh = new Webhook("whsec_xxx");

$headers = [
    'hooksniff-id' => $_SERVER['HTTP_HOOKSNIFF_ID'],
    'hooksniff-timestamp' => $_SERVER['HTTP_HOOKSNIFF_TIMESTAMP'],
    'hooksniff-signature' => $_SERVER['HTTP_HOOKSNIFF_SIGNATURE'],
];

$payload = $wh->verify(file_get_contents('php://input'), $headers);

Authentication

use HookSniff\HookSniff;

// API Key authentication
$client = new HookSniff("sk_live_xxx");

// Custom server URL
use HookSniff\HookSniffOptions;

$options = new HookSniffOptions(
    serverUrl: 'https://your-instance.hooksniff.com'
);
$client = new HookSniff("sk_live_xxx", $options);

Resources

ResourceMethodsDescription
AdminlistUsers, getUserDetail, changePlan, changeStatus, impersonateUser, getSystemStats, getRevenue, getSettings, updateSettingsAdmin panel operations
Alertlist, create, get, update, delete, testAlert management
AnalyticsdeliveryTrend, successRate, latencyTrendDelivery analytics
ApiKeylist, create, delete, rotateAPI key management
Applicationlist, create, get, update, deleteApplication management
Authenticationregister, login, logout, getMe, updateProfile, changePassword, forgotPassword, resetPassword, verifyEmail, enable2fa, confirm2fa, disable2fa, get2faStatusAuth & 2FA
AuditLoglist, getAudit trail
BackgroundTasklist, get, cancelBackground task management
BillinggetSubscription, cancelSubscription, upgrade, openPortal, getUsage, getInvoices, getOverageSettingsBilling & subscriptions
Connectorlist, get, listConfigs, createConfig, getConfig, updateConfig, deleteConfigConnector management
CustomDomainlist, add, delete, verifyCustom domain management
Devicelist, register, deletePush device management
Endpointlist, create, get, update, delete, patch, getHeaders, updateHeaders, patchHeaders, getSecret, rotateSecret, sendExampleEndpoint CRUD
Environmentlist, create, get, update, delete, listVariables, createVariable, updateVariable, deleteVariable, bulkUpsertVariablesEnvironment & variables
EventTypelist, create, get, update, delete, patch, importOpenapiEvent type management
HealthgetHealth check
InboundlistConfigs, createConfig, updateConfig, deleteConfig, handleInbound webhook configs
Integrationlist, get, create, update, delete, test, listEvents, getStatsIntegration management
Messagelist, create, getMessage dispatch
MessageAttemptlistByEndpoint, listByMsg, get, resendDelivery attempts
MessagePollerpoll, seek, commitMessage polling
Notificationlist, unreadCount, markAllRead, markRead, deleteNotifications
OperationalWebhooklist, create, get, update, delete, listDeliveriesOperational webhooks
PortalgetConfig, updateConfig, getProfile, getUsage, getEmbedCodeCustomer portal
RateLimitlist, get, set, deleteRate limiting
Routingget, update, getHealthEndpoint routing
Schemalist, register, get, validateSchema registry
SearchsearchDelivery search
ServiceTokenlist, create, delete, update, revealService tokens
SsogetConfig, upsertConfig, deleteConfig, testConnectionSSO configuration
StatisticsaggregateAppStatsApp statistics
StreamlistChannels, getChannel, createChannel, updateChannel, deleteChannel, listMessages, listSubscriptions, disconnectSubscription, publishReal-time streaming
Teamlist, create, get, acceptInvite, inviteMember, listMembers, removeMember, changeRoleTeam management
Templatelist, get, applyWebhook templates
Transformlist, create, update, delete, testPayload transforms

Error Handling

use HookSniff\Exception\ApiException;

try {
    $client->endpoint->get("nonexistent_id");
} catch (ApiException $e) {
    echo $e->getCode();    // HTTP status code
    echo $e->getMessage(); // Error message
}

Configuration

use HookSniff\HookSniffOptions;

$options = new HookSniffOptions(
    serverUrl: 'https://hooksniff-api-e6ztf3x2ma-ew.a.run.app',  // Custom server
    timeoutMs: 30000,                          // Request timeout
    numRetries: 2,                             // Retry count
    retryScheduleMs: [60, 120, 240],          // Retry delays
    debug: false,                              // Debug mode
);

$client = new HookSniff("sk_live_xxx", $options);

Debug Mode

HOOKSNIFF_DEBUG=1 php your_script.php

Examples

See EXAMPLES.md for detailed usage examples covering all 35 resources.

License

MIT