After Apple changed the APNs Auth Key to p8, the current libraries such as https://github.com/immobiliare/ApnsPHP still use old pem and cert files to connect
$push = new ApnsPHP_Push(
ApnsPHP_Abstract::ENVIRONMENT_SANDBOX,
'server_certificates_bundle_sandbox.pem'
);
// Set the Provider Certificate passphrase
// $push->setProviderCertificatePassphrase('test');
// Set the Root Certificate Autority to verify the Apple remote peer
$push->setRootCertificationAuthority('entrust_root_certification_authority.pem');
// Connect to the Apple Push Notification Service
$push->connect()
With Node.js example (https://eladnava.com/send-push-notifications-to-ios-devices-using-xcode-8-and-swift-3/), I could send like this:
var apnProvider = new apn.Provider({
token: {
key: 'APNsAuthKey_Q34DLF6Z6J.p8', // Path to the key p8 file
keyId: 'Q34DLF6Z6J', // The Key ID of the p8 file (available at https://developer.apple.com/account/ios/certificate/key)
teamId: 'RLAHF6FL89', // The Team ID of your Apple Developer Account (available at https://developer.apple.com/account/#/membership/)
},
production: false // Set to true if sending a notification to a production iOS app
});
How can I use PHP to send remote notifications to iOS like I do in node.js?