INTRODUCTION
This is a simple web push module for Core Boxx. Use the force to send push notifications.
LICENSE & DOWNLOAD
Core Boxx is released under the MIT License. You are free to use it for personal and commercial projects, and modify it as you see fit. On the condition that the software is provided “as-is”. There are no warranties provided and “no strings attached”. Code Boxx and the authors are not liable for any claims, damages, or liabilities.
Download Core Boxx Push Notification Module | GitHub | Source Forge
INSTALLATION
- Make sure that the OpenSSL extension is installed and enabled in PHP.
- Install the “main” Core Boxx first, then unzip this module into your existing Core Boxx project folder.
- Import
lib/SQL-WebPush.sql
into your database. - Enable the push notifications section in
lib/CORE-Config.php
. - Access
http://site.com/push/1
to generate the private/public keys, copy them intolib/CORE-Config.php
. - Access
http://site.com/push/2
and allow notifications to show. - Access
http://site.com/push/3
and send a test notification.
FILES LIST
lib/webpush.php
PHP Web Push By Minishlink.lib/LIB-Push.php
Web Push library.lib/API-Push.php
Web Push API.pages/PAGE-push-1.php
Step 1 – Generate VAPID keys.pages/PAGE-push-2.php
Step 2 – Register service worker and get permission.pages/PAGE-push-3.php
Step 3 – Send test push notification.CB-push-worker.js
Web push service worker.
LIBRARY REFERENCE
WEB PUSH SUBSCRIBERS TABLE
Field | Description |
endpoint |
Primary key. |
data |
JSON encoded subscriber object. |
WEB PUSH LIBRARY FUNCTIONS
Save a subscriber.
$endpoint
String, endpoint URL.$sub
String, JSON encoded subscriber object.
Delete subscriber.
$endpoint
String, endpoint URL.
Send a push notification to all subscribers.
$title
String, title of message.$body
String, text.$icon
String, URL of icon.$image
String, URL of background image.
WEB PUSH API FUNCTIONS
Accessible at http://yoursite.com/api/push/REQUEST/
. These are pretty much a replica of the above library functions, except in REST API format.
Save subscriber.
$_POST["endpoint"]
String, endpoint URL.$_POST["sub"]
String, JSON encoded subscriber object.
Delete a subscriber.
$_POST["endpoint"]
String, endpoint URL.
Send a push notification.
$_POST["title"]
String, title of message.$_POST["body"]
String, text.$_POST["icon"]
String, URL of icon.$_POST["image"]
String, URL of background image.
hello there
am new to all of this so peer with me
where should i find the PUBLIC-KEY & SECRET-KEY
or should i generate it by my self.
and how ?
As “Installation” above – Access
http://site.com/push/1
to generate the keys, copy them intolib/CORE-Config.php
.