mxp100 / pusher
PHP push notifications to APNS, FCM
Installs: 13 996
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 4
Open Issues: 0
Requires
- php: ^7.1
- ext-curl: *
- ext-json: >=1.3.7
Suggests
- ext-curl: *
This package is auto-updated.
Last update: 2025-02-25 01:33:24 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();