Send push notification to Apple Devices (iPhone, iPad)
Before create connection, you should create a certificate and inject it to connection.
This feature was be created, because in any system, the certificated saved to database or another storages, and we should be able to get certificate content and inject to connection.
Create a base certificate and connection:
use Apple\ApnPush\Certificate\Certificate;
use Apple\ApnPush\Notification\Connection;
$certificate = new Certificate('/path/to/certificate.pem', 'you_passphrase');
$connection = new Connection($certificate, $sandbox);
And create a certificate from content:
use Apple\ApnPush\Certificate\ContentCertificate;
use Apple\ApnPush\Notification\Connection;
$content = $storage->getCertificateContent('...');
$passPhrase = $storage->getCertificatePassPhrase('...');
$certificate = new ContentCertificate($content, $passPhrase);
$connection = new Connection($certificate, $sanbox);
Before connect to Apple Apns, system create a temporary file in you system and put certificate content to it. If connection closed, certificate file will be deleted (control on __destruct
).
Fix typos in Connection object, for PHP 5.3 (Array definition)
Add categories to aps data