navvygator / pusher
PHP push notifications to APNS, FCM fork from mxp100/pusher by Yuriy Potemkin
1.1
2017-11-18 20:49 UTC
Requires
- php: ^7.0
- ext-json: >=1.3.7
Suggests
- ext-curl: *
This package is not auto-updated.
Last update: 2025-06-28 18:56:00 UTC
README
Compatable: PHP 7+
Installation
Composer
composer require mxp100/pusher
APNS certicates generate
Please see Wiki: https://github.com/mxp100/Pusher/wiki/Generating-the-Apple-Push-Notification-SSL-certificate-on-Mac
Examples
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();