preflrv/npusher

用于发送Firebase Push API的库

v1.0 2019-04-12 11:49 UTC

This package is auto-updated.

Last update: 2024-09-29 05:42:17 UTC


README

NPusher - 向API-Firebase发送推送通知。

Firebase

API文档

安装

composer require preflrv/npusher

如何使用

use NPusher\NPusher;


// FIREBASE_APIKEY de acesso api firebase;
// 
$apiKey = 'babf40b8-7727-4c70-aaf9-e9fea28a4eea';
$pusher = new NPusher($apiKey);


//Configurações
$tokenDevice = '545454646464'  // Token do device a se recebindo msg.

$config = [
    'sound'         => 'default',
    'priority'      => 'high',
    'adicionalData' => [
        'foreground' => true
    ],
    'notification'  => [
        'body'            => 'Texto notifição', 
        'title'           => 'Titulo da notificação',
    ]
];


//Envia notificação.
$pusher->notify($tokenDevice,$config);