Sending Notifications with PHP
Updated on March 29, 2026
Signalgrid provides an official PHP library that makes it easy to send notifications from any PHP application.
The library is available via Composer and works with:
Repository: https://github.com/signalgridco/signalgrid-php
Install the package using Composer:
composer require signalgrid/signalgrid-php
Composer will automatically download the library and make it available through the autoloader.
To send a notification, create a Signalgrid client and call send().
<?php
require 'vendor/autoload.php';
use Signalgrid\Client;
$signalgrid = new Client("YOUR_CLIENT_KEY");
$signalgrid->send([
"channel" => "YOUR_CHANNEL_TOKEN",
"title" => "Server Alert",
"body" => "Database connection lost",
"type" => "CRIT",
"critical"=> true
]);
channeltitlebodytypecriticalThe following example sends a notification when a script finishes.
<?php
require 'vendor/autoload.php';
use Signalgrid\Client;
$signalgrid = new Client("YOUR_CLIENT_KEY");
$signalgrid->send([
"channel" => "YOUR_CHANNEL_TOKEN",
"title" => "Backup Completed",
"body" => "Nightly backup finished successfully",
"type" => "SUCCESS"
]);
This is useful for:
<?php
require 'vendor/autoload.php';
use Signalgrid\Client;
$signalgrid = new Client("YOUR_CLIENT_KEY");
$signalgrid->send([
"channel" => "YOUR_CHANNEL_TOKEN",
"title" => "Server Down",
"body" => "The web server stopped responding",
"type" => "CRIT",
"critical"=> true
]);
This sends a critical alert that bypasses Do Not Disturb on supported devices.
Avoid hardcoding your client key, use environment variables instead:
$signalgrid = new Client(getenv("SIGNALGRID_CLIENT_KEY"));
Example .env:
SIGNALGRID_CLIENT_KEY=abc123