robwittman / php-notifications
PHP bindings for robwittman/notification-server
Installs: 52
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/robwittman/php-notifications
Requires
- guzzlehttp/guzzle: 6.2.2
- ramsey/uuid: ^3.5
This package is not auto-updated.
Last update: 2025-09-28 01:06:44 UTC
README
PHP bindings for robbybugatti/notification-server
Example
<?php use Notifier\Notifier; use Notifier\Notification; use Notifier\Connection; $url = 'http://localhost:3000'; $token = 'secret-key'; Notifier::init($url, $token); $connection = new Connection($uid); echo $connection->getId(); # returns 5205d501-8c51-4ae6-a603-0e9ecc3dbd75 $payload = [ 'id' => 12341324, 'data' => [ 'test' => true, ] ]; $event = 'data.created'; $notification = new Notification($event, $payload); try { Notifier::send($uid, $notification); } catch(InvalidAuthorizationException $e) { // AUTH TOKEN invalid } catch(InvalidRequestException $e) { // Your request was improperly formatted } catch(\Exception $e) { // Something else happened } Notifier::ping(); # Pings server, and returns true or false Notifier::info(); #returns array('name' => 'server.name', 'version' => '1.0.0')
For further documentation or examples check the container repo