PHP server library for publishing notifications through Pusher Beams.
Check https://docs.pusher.com/beams/reference/server-sdk-php for more information.
Get Composer,
then get the pusher/pusher-push-notifications
Composer package:
$ composer require pusher/pusher-push-notifications
This SDK depends on the JSON PHP module.
<?php
require __DIR__ . '/vendor/autoload.php';
$pushNotifications = new \Pusher\PushNotifications\PushNotifications(array(
"instanceId" => "YOUR_INSTANCE_ID_HERE",
"secretKey" => "YOUR_SECRET_HERE",
));
$publishResponse = $pushNotifications->publish(array("donuts"), array(
"apns" => array("aps" => array(
"alert" => "Hello!",
)),
"fcm" => array("notification" => array(
"title" => "Hello!",
"body" => "Hello, world!",
)),
));
echo("Published with Publish ID: " . $publishResponse->publishId . "\n");