2017 © Pedro Peláez
 

library pushok

PHP client for Apple Push Notification Service (APNs) - Send push notifications to iOS using the new APNs HTTP/2 protocol with token-based (JWT with p8 private key) or certificate-based authentication

image

mammutgroup/pushok

PHP client for Apple Push Notification Service (APNs) - Send push notifications to iOS using the new APNs HTTP/2 protocol with token-based (JWT with p8 private key) or certificate-based authentication

  • Sunday, April 23, 2017
  • by honarkhah
  • Repository
  • 1 Watchers
  • 1 Stars
  • 24 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 31 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Pushok

PHP >= 7.0 Build Status Latest Version on Packagist ![Total Downloads][ico-downloads] Coverage Status Quality Score ![Software License][ico-license], (*1)

Note: This library is under development, (*2)

Pushok is a simple PHP library for sending push notifications to APNs., (*3)

Features

  • [X] Uses new Apple APNs HTTP/2 connection
  • [X] Supports JWT-based authentication
  • [X] Supports new iOS 10 features such as Collapse IDs, Subtitles and Mutable Notifications
  • [X] Uses concurrent requests to APNs
  • [X] Tested and working in APNs production environment
  • [ ] Supports Certificate-based authentication

Requirements

  • PHP >= 7.0
  • lib-curl >= 7.46.0 (with http/2 support enabled)
  • lib-openssl >= 1.0.2e

Docker image that meets requirements can be found here. Or you can follow this tutorial to create your own docker image with curl with HTTP/2 support., (*4)

Install

Via Composer, (*5)

``` bash $ composer require edamov/pushok, (*6)


## Getting Started ``` php <?php require __DIR__ . '/vendor/autoload.php'; use Pushok\AuthProvider; use Pushok\Client; use Pushok\Notification; use Pushok\Payload; use Pushok\Payload\Alert; $options = [ 'key_id' => 'AAAABBBBCC', // The Key ID obtained from Apple developer account 'team_id' => 'DDDDEEEEFF', // The Team ID obtained from Apple developer account 'app_bundle_id' => 'com.app.Test', // The bundle ID for app obtained from Apple developer account 'private_key_path' => __DIR__ . '/private_key.p8', // Path to private key 'private_key_secret' => null // Private key secret ]; $authProvider = AuthProvider\Token::create($options); $alert = Alert::create()->setTitle('Hello!'); $alert = $alert->setBody('First push notification'); $payload = Payload::create()->setAlert($alert); //set notification sound to default $payload = $payload->setSound('default'); //add custom value to your notification, needs to be customized $payload = $payload->setCustomValue('key', 'value'); $deviceTokens = ['<device_token_1>', '<device_token_2>', '<device_token_3>']; $notifications = []; foreach ($deviceTokens as $deviceToken) { $notifications[] = new Notification($payload,$deviceToken); } $client = new Client($authProvider, $production = false); $client->addNotifications($notifications); $responses = $client->push(); // returns an array of ApnsResponseInterface (one Response per Notification) foreach ($responses as $response) { $response->getApnsId(); $response->getStatusCode(); $response->getReasonPhrase(); $response->getErrorReason(); $response->getErrorDescription(); }

Testing

bash $ composer test, (*7)

Security

If you discover any security related issues, please email edamov@gmail.com instead of using the issue tracker., (*8)

Credits

License

The MIT License (MIT). Please see License File for more information., (*9)

The Versions

23/04 2017

dev-master

9999999-dev https://github.com/edamov/pushok

PHP client for Apple Push Notification Service (APNs) - Send push notifications to iOS using the new APNs HTTP/2 protocol with token-based (JWT with p8 private key) or certificate-based authentication

  Sources   Download

MIT

The Requires

  • php ^7.0
  • ext-curl *
  • lib-curl >=7.46.0
  • ext-openssl *
  • lib-openssl >=1.0.2.5
  • ext-gmp *
  • ext-xml *
  • ext-intl *
  • spomky-labs/jose ^6.1.1

 

The Development Requires

apns push notifications p8 php apns

27/12 2016

dev-feature/travis

dev-feature/travis https://github.com/edamov/pushok

PHP client for Apple Push Notification Service (APNs) - Send push notifications to iOS using the new APNs HTTP/2 protocol with token-based (JWT) or certificate-based authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

apns push notifications

10/11 2016

0.2.0

0.2.0.0 https://github.com/edamov/pushok

PHP client for Apple Push Notification Service (APNs) - Send push notifications to iOS using the new APNs HTTP/2 protocol with token-based (JWT) or certificate-based authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

apns push notifications

10/11 2016

dev-feature/certificate-auth

dev-feature/certificate-auth https://github.com/edamov/pushok

PHP client for Apple Push Notification Service (APNs) - Send push notifications to iOS using the new APNs HTTP/2 protocol with token-based (JWT) or certificate-based authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

apns push notifications

07/11 2016

0.1.0

0.1.0.0 https://github.com/edamov/pushok

PHP client for Apple Push Notification Service (APNs) - Send push notifications to iOS using the new APNs HTTP/2 protocol with token-based (JWT) or certificate-based authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

apns push notifications