Compatable: PHP 7+
composer require mxp100/pusher
Please see Wiki: https://github.com/mxp100/Pusher/wiki/Generating-the-Apple-Push-Notification-SSL-certificate-on-Mac
Example for FCM:
$serverKey = '[server key]';
$deviceId = '[device token]';
$devices = new DeviceCollection([new Device($deviceId)]);
$message = new Message('This is a test message');
$adapter = new Fcm($serverKey);
$pusher = new Pusher([new Push($adapter, $devices, $message)]);
$pusher->push();
Example for GCM:
$serverKey = '[path to certification]';
$deviceId = '[device token]';
$devices = new DeviceCollection([new Device($deviceId)]);
$message = new Message('This is a test message');
$adapter = new Gcm($serverKey, AdapterInterface::ENVIRONMENT_DEVELOPMENT);
$pusher = new Pusher([new Push($adapter, $devices, $message)]);
$pusher->push();
Example for APNS:
$serverKey = '[path to certification]';
$deviceId = '[device token]';
$devices = new DeviceCollection([new Device($deviceId)]);
$message = new Message('This is a test message');
$adapter = new Apns($serverKey, AdapterInterface::ENVIRONMENT_DEVELOPMENT);
$pusher = new Pusher([new Push($adapter, $devices, $message)]);
$pusher->push();