2017 © Pedro Peláez
 

library php-gcm-apns

A PHP Library for sending messages to devices (Android & IOS) through GCM and Apns (respectively).

image

albaraam/php-gcm-apns

A PHP Library for sending messages to devices (Android & IOS) through GCM and Apns (respectively).

  • Thursday, July 14, 2016
  • by albaraam
  • Repository
  • 2 Watchers
  • 12 Stars
  • 2,431 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 2 Versions
  • 7 % Grown

The README.md

albaraam/php-gcm-apns

A PHP Library for sending messages to devices (Android & IOS) through GCM and Apns (respectively)., (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

composer require albaraam/php-gcm-apns "~1.0.0"

or add, (*4)

"albaraam/php-gcm-apns": "~1.0.0"

to the require section of your composer.json., (*5)

Usage


use albaraam\gcmapns\Message; use albaraam\gcmapns\Client; // Message creation $message = new Message("Title","Body"); // Common attributes for both ios and android $message ->setTitle("Title") ->setBody("Body") ->setSound("sound.mp3") ->setData(['foo'=>'bar']); // Android specific attributes $message->android ->setTo("ids") ->setIcon("icon") ->setCollapseKey("collapse_key") ->setColor("#333"); // IOS specific attributes $message->ios ->setTo("ids") ->setSound("sound_ios.mp3") // custom sound for ios ->setBadge(3); // Client $client = new Client("google_api_key","path/to/pem/file",Client::IOS_ENVIRONMENT_SANDBOX); // configure client $client->setIosPassphrase("passphrase"); ... // Send message $client->send($message);

Usage: Advanced Example


use albaraam\gcmapns\Message; use albaraam\gcmapns\Client; $message = new Message("Title","Body"); $message ->setTitle("Title") ->setBody("Body") ->setPriority(5) // 5 or 10 ->setContentAvailable(true) ->setDryRun(false) ->setClickAction("") // same as Category ->setCategory("") // same as ClickAction ->setTitleLocKey("") ->setTitleLocArgs("") ->setBodyLocKey("") ->setBodyLocArgs("") ->setSound("sound.mp3") ->setData(['foo'=>'bar']); $message->android ->setTo("ids") ->setIcon("icon") ->setCollapseKey(true) ->setDelayWhileIdle(true) ->setTimeToLive(3600) ->setRestrictedPackageName("") ->setTag("") ->setColor("#333"); $message->ios ->setTo("ids") ->setLaunchImage("") ->setBadge(3) ->setActionLocKey(""); $client = new Client("google_api_key","path/to/pem/file",Client::IOS_ENVIRONMENT_SANDBOX); $client->setIosPassphrase("passphrase"); $client->sendAndroid($message)) // send for android devices only $client->sendIOS($message)) // send for ios devices only // $client->send($message)) // send for both ios & android devices

The Versions

14/07 2016

dev-master

9999999-dev

A PHP Library for sending messages to devices (Android & IOS) through GCM and Apns (respectively).

  Sources   Download

MIT License

The Requires

 

by Albaraa Mishlawi

php push gcm apns php-gcm-apns

10/12 2015

v1.0.0

1.0.0.0

A PHP Library for sending messages to devices (Android & IOS) through GCM and Apns (respectively).

  Sources   Download

MIT License

The Requires

 

by Albaraa Mishlawi

php push gcm apns php-gcm-apns