2017 © Pedro Peláez
 

library apns2

Simple & expressive PHP HTTP2 API for Apple Push Notification service (APNs) with comprehensive docs/constants.

image

dashi/apns2

Simple & expressive PHP HTTP2 API for Apple Push Notification service (APNs) with comprehensive docs/constants.

  • Thursday, July 6, 2017
  • by dashi
  • Repository
  • 1 Watchers
  • 1 Stars
  • 80 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 7 % Grown

The README.md

apns2

Simple & expressive PHP HTTP2 API for Apple Push Notification service (APNs) with comprehensive docs/constants., (*1)

Guidance

  1. Make Sure CURL Supports HTTP/2 (for php version < 5.5.24, check here)
  2. Creating a Universal Push Notification Client SSL Certificate (.p12)
  3. Converting .p12 to .pem > openssl pkcs12 -in cert.p12 -out cert.pem -nodes -clcerts
  4. Go > composer require dashi/apns2

Usage

using classes

$connection = new Dashi\Apns2\Connection();
$connection->sandbox = false;
$connection->certPath = '/path/to/http2/cert.pem';

$aps = new Dashi\Apns2\MessageAPSBody();
$aps->alert = 'test 1';
$aps->sound = 'default';

$message = new Dashi\Apns2\Message();
$message->aps = $aps;

$options = new Dashi\Apns2\Options();
$options->apnsTopic = 'your.bundle.id';

$responses = $connection->send([
    '81fbf7e296f6c94755832a48476182e4e9586a380116e18a46531b62349504f0',
    'e2d0b464813b6b2371d745dff2b1e5fb6b83b07f7dcd98cc9f1346a7752dcc45',
], $message, $options);
$connection->close();
var_dump($responses);

using arrays

$connection = new \Dashi\Apns2\Connection(['sandbox' => true, 'cert-path' => '/path/to/http2/cert.pem']);

$responses = $connection->send([
    '81fbf7e296f6c94755832a48476182e4e9586a380116e18a46531b62349504f1' // invalid
], [
    'aps' => [
        'alert' => 'test 2',
        'sound' => 'default',
    ]
], [
    'apns-topic' => 'your.bundle.id',
]);
$connection->close();

check response data

echo "check response: {$responses[0]->apnsId} == ${uuid}\n";
assert($responses[0]->apnsId == $uuid);

$reason = \Dashi\Apns2\Response::REASON_BAD_DEVICE_TOKEN;
echo "check response: {$responses[0]->reason} == ${reason}\n";
assert($responses[0]->reason == $reason);

License

MIT, (*2)

The Versions

06/07 2017

dev-master

9999999-dev https://github.com/huxia/apns2

Simple & expressive PHP HTTP2 API for Apple Push Notification service (APNs) with comprehensive docs/constants.

  Sources   Download

MIT

The Requires

 

by Huizhe

php simple notification apple push apns http2

06/07 2017

1.3

1.3.0.0 https://github.com/huxia/apns2

Simple & expressive PHP HTTP2 API for Apple Push Notification service (APNs) with comprehensive docs/constants.

  Sources   Download

MIT

The Requires

 

by Huizhe

php simple notification apple push apns http2

06/07 2017

1.2

1.2.0.0 https://github.com/huxia/apns2

Simple & expressive PHP HTTP2 API for Apple Push Notification service (APNs) with comprehensive docs/constants.

  Sources   Download

MIT

The Requires

 

by Huizhe

php simple notification apple push apns http2

07/04 2017

1.1

1.1.0.0 https://github.com/huxia/apns2

Simple & expressive HTTP2 API for Apple Push Notification service (APNs) with comprehensive docs/constants.

  Sources   Download

MIT

The Requires

 

by Huizhe

simple notification apple push apns http2

05/04 2017

1.0

1.0.0.0 https://github.com/huxia/apns2

Simple & expressive HTTP2 API for Apple Push Notification service (APNs) with comprehensive docs/constants.

  Sources   Download

MIT

The Requires

 

by Huizhe

simple notification apple push apns http2