absystem / gfcm
PHP Google Cloud Messaging (GCM) Library
v1.0
2020-11-08 18:25 UTC
Requires
- guzzlehttp/guzzle: ~6.0
This package is auto-updated.
Last update: 2024-04-09 02:15:36 UTC
README
Google Firebase Cloud Messaging with PHP
INSTALLATION 🔥
composer require absystem/gfcm
REQUIREMENTS ⚠️
▪️ PHP >=5.6.
▪️ Composer.
▪️ Guzzle v6.x sudah include di package.
SETTING CONFIG 🌐
$config = [ 'server_key' => '', // kunci server dari google console 'base_url' => 'https://fcm.googleapis.com/fcm/send' ]; //array token device $tokendevice = [];
CONTOH PENGGUNAAN 💻
require_once __DIR__ . '/vendor/autoload.php'; use ABSystem\Google\FCM; $fcm = new FCM($config); $fcm->setTokenDevice($tokendevice); $fcm->setDataPayload([ 'koordinat' => [ 'lat' => '', 'lng' => '', ], 'link' => [ 'page'=> '/map.html' ], ]); $fcm->setPesan('Judul Notifikasi', 'Isi pesan yang tampil.'); $fcm->kirim();