Trigv home

Search docs

Getting started
  • Overview
  • How Trigv works
Help
  • Send test
  • API keys
  • Channels
  • Image attachments
Guides
  • All guides
  • cURL
  • Laravel
  • AI coding agents
  • Cursor
  • Claude Code
  • OpenAI Codex
  • Other agents
SDKs
  • All SDKs
  • JavaScript
  • Python
  • PHP
  • Go
  • Ruby
  • CLI
API reference
  • API overview
  • POST /api/v1/events
  • Errors & rate limits
  • API security
More
  • OpenAPI spec
Open in ChatGPT ↗ Ask questions about this page Open in Claude ↗ Ask questions about this page Open Markdown https://trigv.com/docs-md/sdks/php.md

PHP SDK

Use the official Trigv PHP SDK to send push notifications from Laravel apps, WordPress plugins, backend jobs, payment handlers, and plain PHP scripts.

Install

Code
composer require trigv/trigv

Requires PHP 8.2+ with the curl and json extensions.

Send a notification

Code
use Trigv\Client;

$trigv = new Client(['api_key' => getenv('TRIGV_API_KEY')]);

$result = $trigv->sendEvent([
	'channel' => 'general',
	'title' => 'Payment received',
	'description' => 'Order was paid successfully',
	'level' => 'success',
	'event_type' => 'payment.success',
]);

echo $result->event->public_id;

Event fields

FieldRequiredDescription
channelYesChannel slug, such as general, deploys, or payments.
titleYesPush notification title.
descriptionNoBody text shown in the notification.
image_urlNoHTTPS image URL for screenshots, charts, camera snapshots, or previews.
urlNoDestination URL opened from the notification.
levelNoinfo, success, warning, or error. Defaults to info.
delivery_urgencyNostandard or time_sensitive. Defaults to standard.
event_typeNoFree-form event label such as deploy.completed or cron.failed.
idempotency_keyNoDeduplication key for safe retries.

You can pass an array or a Trigv\SendEventRequest value object.

Safe retries with idempotency

Code
$result = $trigv->sendEvent([
		'channel' => 'deploys',
		'title' => 'Production deploy complete',
		'idempotency_key' => 'deploy-prod-42',
]);

if ($result->duplicate) {
		// Already accepted earlier.
}

Configuration

OptionDefaultDescription
api_keyTRIGV_API_KEYWorkspace API key.
base_urlhttps://api.trigv.com/apiAPI base URL.
timeout30Request timeout in seconds.
max_retries2Retry count for retryable failures.
http_clientcURLCustom HTTP client for testing or framework integration.

Verify the API key

Code
$connection = $trigv->verifyConnection();
echo $connection->workspace->name;

Error handling

Code
use Trigv\Exception\AuthenticationException;
use Trigv\Exception\NotFoundException;
use Trigv\Exception\RateLimitException;
use Trigv\Exception\ValidationException;

try {
	$trigv->sendEvent(['channel' => 'general', 'title' => 'Hello']);
} catch (ValidationException $e) {
	print_r($e->errors);
} catch (NotFoundException $e) {
	echo 'Channel not found';
} catch (RateLimitException $e) {
	echo $e->retryable ? 'Retry later' : 'Monthly limit reached';
} catch (AuthenticationException $e) {
	echo 'Invalid API key';
}

Good places to use it

  • Laravel jobs, commands, listeners, and webhook handlers
  • WordPress plugins that need focused push alerts
  • Payment, billing, subscription, and operational workflows

Additional resources

Packagist Composer package Install the official Trigv PHP SDK from Packagist. Source code View the PHP SDK source on GitHub.
Previous Python Next Go

On this page

    Native push alerts for developers. Send alerts from webhooks, cron jobs, and scripts. We deliver alerts to your devices, but don't keep the message or notification history on our servers.

    Follow @trigvapp →

    Built by Harish Chouhan

    Product

    • Features
    • How it works
    • Pricing
    • Docs
    • Integrations
    • SDKs
    • API
    • Full LLMs text

    Company

    • About
    • Support
    • Changelog

    Legal

    • Terms & Conditions
    • Privacy Policy
    • Cookie Policy
    • API Security
    All systems ok. Get back to coding.

    © 2026 Webtions OU (dba Trigv)