Skip to content
forked from mhndev/pusher

simple unified pusher service (pusher.com, pubnub , Fcm , Gcm , Nginx Push Stream Module) all with single nterface

Notifications You must be signed in to change notification settings

momostafa/pusher

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Single Interface Multiple Pusher Service

single interface for using multiple pusher service

Included Service

  • FCM
  • GCM
  • Nginx Push Stream Module
  • Pubnub.com
  • Pusher.com

Sample Usage

use mhndev\pusher\PusherFactory;

require 'vendor/autoload.php';


$httpClient = new \GuzzleHttp\Client();

$message = new \mhndev\pusher\Message([
    'name'   => 'majid',
    'family' => 'abdolhosseini',
    'age'    => 25
]);




//send message using pusher.com service
$pusherDotComService = PusherFactory::createPusher(
    PusherFactory::PUSHER_PUSHERDOTCOM,
    ['app_key', 'app_secret', 'app_id', []]
);
$pusherDotComService->push($message, 'device1');




//send message using pubnub.com service
$pubnub = PusherFactory::createPusher(
    PusherFactory::PUSHER_PUBNUB, 
    ['public_key', 'subscribe_key', 'secret_key']
);
$pubnub->push($message, 'device1');



//send message using FCM service
$fcm = PusherFactory::createPusher(
    PusherFactory::PUSHER_FCM, 
    ['api_key', $httpClient]
);
$fcm->push($message, 'device1');



//send message using GCM service
$gcm = PusherFactory::createPusher(
    PusherFactory::PUSHER_GCM,
    ['api_key']
);
$gcm->push($message, 'device1');



//send message using nginx push stream module
$nginx = PusherFactory::createPusher(
    PusherFactory::PUSHER_NGINXMODULE,
    [$httpClient, 'http:https://example.com:8000']
);
$nginx->push($message, 'device1');

About

simple unified pusher service (pusher.com, pubnub , Fcm , Gcm , Nginx Push Stream Module) all with single nterface

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%