2017 © Pedro Peláez
 

standalone push-notification-php-library

Send push notification to android|ios devices , support APNs, FCM

image

push-notification/push-notification-php-library

Send push notification to android|ios devices , support APNs, FCM

  • Saturday, December 2, 2017
  • by asadijabar
  • Repository
  • 2 Watchers
  • 14 Stars
  • 192 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 17 % Grown

The README.md

⚠️ This repository is archived and no longer maintained., (*1)

The code is provided as-is, without any guarantees of updates or support., (*2)

Push Notification Library for php

Standalone PHP library for easy devices message notifications push.
Feel free to contribute!, (*3)

Installation

composer require push-notification/push-notification-php-library
composer dump-autoload -o 

This repository uses PSR-0 autoload. After installation with composer please adjust you autoloading config if needed or include vendor/autoload.php in your index.php., (*4)

Requirements:, (*5)

  • PHP 5.6+
  • PHP Curl and OpenSSL modules

available supports:, (*6)

  • APNS (Apple)
  • GCM (Android) and FCM (Android)

Setting

  1. settings of your provider (Apn, Fcm) at .env (make sure you renamed the .env.example to .env and filled all the requirements), (*7)

  2. path to .env file : you need to set $path variable at src/PushNotification/Setting to the .env file, (*8)

How to use :

include_once "vendor/autoload.php";

use PushNotification\Service\PushService;

$data = array(
    'device' => array(
        'name' => '', // Android or AppleIOS
        'token' => '', // device token | user token , if you want to send to apple device you have to fill this 
        'id' => 'unique id here'),

    'message' => array(
        'action' => 'test',
        'title' => 'this is test title',
        'targets' => array(''), // if you want to use Fcm you can inclue array of targets 
        'body' => 'this is body',
        'type' => '', // AndroidMessages or IOSMessages
        'data' => array('type' => 'testType'))
);

$response  = PushService::getInstance()->send($data);

Android :

include_once "vendor/autoload.php";

use PushNotification\Service\PushService;

$data = array(
    'device' => array(
        'name' => 'Android',  
        'token' => '', 
        'id' => 'some id here '),

    'message' => array(
        'action' => 'test',
        'title' => 'this is test title',
        'targets' => array('token1', 'token2', 'token3'),
        'body' => 'this is body',
        'type' => 'AndroidMessages',  
        'data' => array('type' => 'testType'))
);
$response  = PushService::getInstance()->send($data);
print_r($response);

IOS :

include_once "vendor/autoload.php";

use PushNotification\Service\PushService;

$data = array(
    'device' => array(
        'name' => 'AppleIOS',
        'token' => 'token',
        'id' => 'BECDSx'),

    'message' => array(
        'action' => 'test',
        'title' => 'this is test title',
        'targets' => array(),
        'body' => 'this is body',
        'type' => 'IOSMessages', 
        'data' => array('type' => 'testType'))
);
$response  = PushService::getInstance()->send($data);
print_r($response);

The Versions

02/12 2017

dev-master

9999999-dev

Send push notification to android|ios devices , support APNs, FCM

  Sources   Download

MIT

The Requires

 

by jabar asadi

message notification apple push gcm apns android iphone pusher

02/12 2017

v1.2

1.2.0.0

Send push notification to android|ios devices , support APNs, FCM

  Sources   Download

MIT

The Requires

 

by jabar asadi

message notification apple push gcm apns android iphone pusher

04/11 2017

v1.1

1.1.0.0

Send push notification to android|ios devices , support APNs, FCM

  Sources   Download

MIT

The Requires

 

by jabar asadi

message notification apple push gcm apns android iphone pusher

26/09 2017

v1.0

1.0.0.0

Send push notification to android|ios devices , support APNs, FCM

  Sources   Download

MIT

The Requires

 

by jabar asadi

message notification apple push gcm apns android iphone pusher