The Wayback Machine - https://web.archive.org/web/20200208193633/https://github.com/Minishlink/web-push-php-example
Skip to content
An example for sending Web Push notifications, using web-push-php
JavaScript PHP HTML
Branch: master
Clone or download
Latest commit 9e83e6b Feb 23, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
keys Upgrade deps + change VAPID keys Feb 23, 2019
src Add prettier Feb 23, 2019
.gitignore composer init Apr 21, 2017
.prettierrc Add prettier Feb 23, 2019
LICENSE Initial commit Apr 21, 2017
README.md Upgrade deps + change VAPID keys Feb 23, 2019
composer.json Upgrade to 5.2 Feb 23, 2019
composer.lock Upgrade to 5.2 Feb 23, 2019
router.php Update router.php (#13) Apr 2, 2018

README.md

Web Push example in PHP

Navigating through the commits and files will help you build:

  • on the client
    • a user friendly opt-in push notification button
  • on the server
    • an endpoint for managing your push notification subscriptions
    • an endpoint that triggers push notification thanks to web-push-php

Requirements

  • Chrome or Firefox
  • PHP 7.1+
    • gmp
    • mbstring
    • curl
    • openssl

PHP 5.6+ is no longer maintained, but you can checkout the v1.x branch.

Installation

$ composer create-project minishlink/web-push-php-example
$ cd web-push-php-example

You can change the VAPID keys in the keys folder with this guide. Don't forget to update the public key in app.js too.

Usage

$ php -S localhost:8000 router.php

And open localhost:8000.

You can’t perform that action at this time.