preflrv/npusher

Lib para envio de push Api-Firebase

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

This package is auto-updated.

Last update: 2024-03-29 03:51:30 UTC


README

NPusher - Envio de notificação push para API-Firebase.

Firebase

Doc API

Instalação

composer require preflrv/npusher

Como utilizar

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);