2017 © Pedro Peláez
 

standalone push-notiphications

Push notifications library for Apns and Gcm for PHP

image

khrizt/push-notiphications

Push notifications library for Apns and Gcm for PHP

  • Monday, July 18, 2016
  • by khrizt
  • Repository
  • 1 Watchers
  • 3 Stars
  • 81 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 11 Versions
  • 0 % Grown

The README.md

PushNotiphications

Push notifications library for Apns and Fcm for PHP, (*1)

Using only cURL as library and Symfony Console for command-line commands this package supports Firebase Cloud Message (if you still use GCM, you can use it too) and APNS with HTTP/2 mode., (*2)

Requirements

  • PHP 7.1+
  • PHP Curl and OpenSSL modules
  • cURL with HTTP/2 support (check this for Debian/Ubuntu users: https://serversforhackers.com/video/curl-with-http2-support)

Installation

composer require khrizt/push-notiphications

Usage example

FCM, (*3)

use Khrizt\PushNotiphications\Client\Fcm;
use Khrizt\PushNotiphications\Collection\Collection;
use Khrizt\PushNotiphications\Model\Device;
use Khrizt\PushNotiphications\Model\Fcm\Message as FcmMessage;

$fcmMessage = new FcmMessage();
$fcmMessage->setBody($message)
           ->setTitle($title);

$device = new Device($token);
$collection = new Collection();
$collection->append($device);

$client = new Fcm($apiKey);
$responseCollection = $client->send($fcmMessage, $collection);

foreach ($responseCollection as $response) {
    echo 'Status for notification sent to '.$response->getToken().' was '.($response->isOk() ? 'OK' : ' Error. Error message: '.$response->getErrorMessage());
}

APNS, (*4)

use Khrizt\PushNotiphications\Client\Apns;
use Khrizt\PushNotiphications\Collection\Collection;
use Khrizt\PushNotiphications\Constants;
use Khrizt\PushNotiphications\Model\Device;
use Khrizt\PushNotiphications\Model\Apns\Message as ApnsMessage;

$apnsMessage = new ApnsMessage();
$apnsMessage->setBody($message)
            ->setTopic($topic);

$device = new Device($token);
$collection = new Collection();
$collection->append($device);

$client = new Apns(Constants::DEVELOPMENT, $certificate, $certificatePassphrase);
$responseCollection = $client->send($apnsMessage, $collection);

foreach ($responseCollection as $response) {
    echo 'Status for notification sent to '.$response->getToken().' was '.($response->isOk() ? 'OK' : '. Error message: '.$response->getErrorMessage());
}

The Versions

18/07 2016

dev-master

9999999-dev https://github.com/khrizt/PushNotiphications

Push notifications library for Apns and Gcm for PHP

  Sources   Download

Apache License 2.0

The Requires

 

by Christian Fuentes

message notification apple push gcm apns android iphone pusher notiphications

18/07 2016

0.4.3

0.4.3.0 https://github.com/khrizt/PushNotiphications

Push notifications library for Apns and Gcm for PHP

  Sources   Download

Apache License 2.0

The Requires

 

by Christian Fuentes

message notification apple push gcm apns android iphone pusher notiphications

15/06 2016

0.4.2

0.4.2.0 https://github.com/khrizt/PushNotiphications

Push notifications library for Apns and Gcm for PHP

  Sources   Download

Apache License 2.0

The Requires

 

by Christian Fuentes

message notification apple push gcm apns android iphone pusher notiphications

15/06 2016

0.4.1

0.4.1.0 https://github.com/khrizt/PushNotiphications

Push notifications library for Apns and Gcm for PHP

  Sources   Download

Apache License 2.0

The Requires

 

by Christian Fuentes

message notification apple push gcm apns android iphone pusher notiphications

14/06 2016

0.4.0

0.4.0.0 https://github.com/khrizt/PushNotiphications

Push notifications library for Apns and Gcm for PHP

  Sources   Download

Apache License 2.0

The Requires

 

by Christian Fuentes

message notification apple push gcm apns android iphone pusher notiphications

14/06 2016

0.3.3

0.3.3.0 https://github.com/khrizt/PushNotiphications

Push notifications library for Apns and Gcm for PHP

  Sources   Download

Apache License 2.0

The Requires

 

by Christian Fuentes

message notification apple push gcm apns android iphone pusher notiphications

14/06 2016

0.3.2

0.3.2.0 https://github.com/khrizt/PushNotiphications

Push notifications library for Apns and Gcm for PHP

  Sources   Download

Apache License 2.0

The Requires

 

by Christian Fuentes

message notification apple push gcm apns android iphone pusher notiphications

14/06 2016

0.3.1

0.3.1.0 https://github.com/khrizt/PushNotiphications

Push notifications library for Apns and Gcm for PHP

  Sources   Download

Apache License 2.0

The Requires

 

by Christian Fuentes

message notification apple push gcm apns android iphone pusher notiphications

14/06 2016

0.3

0.3.0.0 https://github.com/khrizt/PushNotiphications

Push notifications library for Apns and Gcm for PHP

  Sources   Download

Apache License 2.0

The Requires

 

by Christian Fuentes

message notification apple push gcm apns android iphone pusher notiphications

14/06 2016

0.2

0.2.0.0 https://github.com/khrizt/PushNotiphications

Push notifications library for Apns and Gcm for PHP

  Sources   Download

Apache License 2.0

The Requires

 

by Christian Fuentes

message notification apple push gcm apns android iphone pusher notiphications

14/06 2016

0.1

0.1.0.0 https://github.com/khrizt/PushNotiphications

Push notifications library for Apns and Gcm for PHP

  Sources   Download

Apache License 2.0

The Requires

 

by Christian Fuentes

message notification apple push gcm apns android iphone pusher notiphications