Send a push notification to iOS devices
Simple send a push notification to APPLE APNs server.
PHP class that can send push notifications, really simple class that sends a notification with the parameters like sound, badge, etc.
|
|
How to use:
create new instance
Objective-C
1 |
$apns = new SAPN( SAPN::DEVELOPMENT ); |
add certificate
Objective-C
1 |
$apns ->setCertificateFile('/PATH/TO/CERT/CERT.pem'); |
add device token
Objective-C
1 |
$apns ->addDeviceToken('bf447b59acd20718565b763e2de11382a0db1dc17caec4899fefd9790d0422a4'); |
set custom variables
Objective-C
1 |
$apns ->setCustomVariable('referenceId', 382); |
set badge
Objective-C
1 |
$apns->setBadge(3); |
set sound
Objective-C
1 |
$apns->setSound('default'); |
set Passphrase
Objective-C
1 |
$apns->setCertificatePassphrase('password'); |
set puhs notificatoin message
Objective-C
1 |
$apns ->setMessage('this is my push message'); |
send message
Objective-C
1 |
$apns ->send(); |
Class you can found at github.com/zaachi/sapn
Posted on 7 March 2013