mhndev / pusher
single interface for using multiple pusher service
1.1.1
2017-02-20 22:10 UTC
Requires
- php: >=5.4.0
- paragraph1/php-fcm: ^0.7.0
- php-gcm/php-gcm: dev-master
- phpmailer/phpmailer: ^5.2
- pubnub/pubnub: ~3.8.3
- pusher/pusher-php-server: ~2.6.0
- swiftmailer/swiftmailer: ^5.4
Requires (Dev)
- mockery/mockery: 0.9.5
- phpunit/phpunit: 6.*
- raveren/kint: ^1.0
- satooshi/php-coveralls: dev-master
This package is auto-updated.
Last update: 2024-10-06 09:43:15 UTC
README
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://example.com:8000'] ); $nginx->push($message, 'device1');