PHP code example of con4gis / pwa
1. Go to this page and download the library: Download con4gis/pwa library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
con4gis / pwa example snippets
// get the event dispatcher
$eventDispatcher = $this->eventDispatcher;
// instantiate event
$event = new PushNotificationEvent();
// this sends the notification to every subscribed user. You can send a notification to only one subscription, too
$event->setSendToAll(true);
// set message contents
$event->setTitle($title);
$event->setMessage($content);
// dispatch the event
$eventDispatcher->dispatch($event::NAME, $event);