2017 © Pedro Peláez
 

library phpush

PHP Package to send push notifications

image

mhamlet/phpush

PHP Package to send push notifications

  • Sunday, May 21, 2017
  • by mhamlet
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

PHPush

Latest Version Build Status Quality Score Total Downloads, (*1)

PHPush is a PHP package that provide a simple API to send push notifications to foreign platforms., (*2)

Currently, we support 3 platforms - Android, iOS, and Google Chrome., (*3)

Installation

Add the package in your composer.json by executing the following command:, (*4)

composer require mhamlet/phpush

Example

The following examples demonstrate how to send Push notifications with text "Hello, World!" to 2 devices in different platforms., (*5)

```php // Include composer autoloader require_once 'vendor/autoload.php';, (*6)

use PHPush\PHPush;, (*7)

// Setting environment PHPush::Environment(PHPush::ENVIRONMENT_PRODUCTION);, (*8)

// Adding Android key PHPush::Provider(\PHPush\Provider::PROVIDER_ANDROID)->setAccessKey('test');, (*9)

// Adding iOS certificate PHPush::Provider(\PHPush\Provider::PROVIDER_IOS)->setCertificate('ck.pem');, (*10)

// Creating new queue $queue = PHPush::Queue();, (*11)

// Adding some devices $queue->add(new \PHPush\providers\android\Device('android_registration_id')); $queue->add(new \PHPush\providers\chrome\Device('chrome_registration_id')); $queue->add(new \PHPush\providers\ios\Device('ios_device_token'));, (*12)

// Setting message $queue->message('Hello World!');, (*13)

// Send message. You can provide custom fields to this method. // Also you can pass sound and passphrase with this custom fields $queue->send(array( 'custom' => 'field', 'sound' => 'popup.aif', 'passphase' => 'phpush', ));, (*14)

// Creating another queue $another_queue = PHPush::Queue();, (*15)

// Adding only one device $another_queue->add(new \PHPush\providers\ios\Device('another_or_the_same_ios_device_token'));, (*16)

// Setting message $another_queue->message('Hello World! I\'m second queue!');, (*17)

// This will not open a connection to APNS server again. // It will use the old connection $another_queue->send();, (*18)

The Versions

21/05 2017

dev-master

9999999-dev

PHP Package to send push notifications

  Sources   Download

MIT License

05/07 2016

v1.3

1.3.0.0

PHP Package to send push notifications

  Sources   Download

MIT License

05/09 2015

1.2

1.2.0.0

PHP Package to send push notifications

  Sources   Download

MIT License

17/05 2015

v1.1

1.1.0.0

PHP Class to send push notifications

  Sources   Download

MIT License

by Hility

06/06 2014

1.0

1.0.0.0

PHP Class to send push notifications

  Sources   Download

MIT License

by Hility