albo-vieira / push-notification
为移动设备发送通知
dev-master
2016-08-25 14:51 UTC
Requires
- guzzlehttp/guzzle: ^6.1
This package is not auto-updated.
Last update: 2024-09-26 02:07:23 UTC
README
为Android(使用GCM)和iOS发送推送通知。
安装
composer require albo-vieira/push-notification dev-master
用法
复制文件push_config,并在您的项目中引入它,根据需要设置选项。
include('push_config.php');
ANDROID
$result = $android = PushNotification\PushFactory::getInstance('android', $pushConfig) ->withTokens([ 'TOKENS', ]) ->withNotification(['title' => 'title', 'text' => 'Texto']) ->send(); print_r($result);
IOS
$result = $ios = PushNotification\PushFactory::getInstance('ios', $pushConfig) ->withTokens(['TOKENS']) ->withNotification(['alert' => 'Texto', 'badge' => 1, 'sound' => 'default']) ->send(); print_r($result);