Skip to content

Latest commit

 

History

History
49 lines (37 loc) · 961 Bytes

README.md

File metadata and controls

49 lines (37 loc) · 961 Bytes

GFCM

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