https://github.com/sagarmaheshwary/webpush-example
A basic push notifications app built on Laravel and Vanilla Javascript.
https://github.com/sagarmaheshwary/webpush-example
javascript laravel mysql notifications push-notifications service-worker webpush
Last synced: 4 months ago
JSON representation
A basic push notifications app built on Laravel and Vanilla Javascript.
- Host: GitHub
- URL: https://github.com/sagarmaheshwary/webpush-example
- Owner: SagarMaheshwary
- License: mit
- Created: 2018-12-02T18:54:51.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-25T15:19:08.000Z (over 6 years ago)
- Last Synced: 2025-04-08T18:39:29.059Z (7 months ago)
- Topics: javascript, laravel, mysql, notifications, push-notifications, service-worker, webpush
- Language: PHP
- Homepage: https://medium.com/@sagarmaheshwary31/push-notifications-with-laravel-and-webpush-446884265aaa
- Size: 282 KB
- Stars: 38
- Watchers: 1
- Forks: 15
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Laravel Web Push Example
A basic example of using webpush notifications with laravel and Javascript. Push Notifications are a part of Service Workers and It requires HTTPS unless you are using localhost.## Running this web application
- make sure you have xampp or wamp installed if you are on windows machine, mamp for mac , and lamp for linux.- clone this repository to your local machine or just download the zip.
- install [Composer](https://getcomposer.org/download) first, then run this command in your command-line (you should be inside your project directory).
```bash
composer install
```- rename .env.example to .env and configure your database.
- generate application key.
```bash
php artisan key:generate
```- create tables by migrations.
```bash
php artisan migrate
```- Generate VAPID Keys (this command will place the VAPID keys in your .env file).
```bash
php artisan webpush:vapid
```- Add the VAPID public key to application server key in enable-push.js file located in public/js directory, here's the link to that [line](https://github.com/SagarMaheshwary/webpush-example/blob/0a0be26c038ea6de1289035c19bc715513340356/public/js/enable-push.js#L64)
- Start Laravel dev server.
```bash
php artisan serve
```
- Read the entire tutorial [Push Notifications with Laravel and Webpush](https://medium.com/@sagarmaheshwary31/push-notifications-with-laravel-and-webpush-446884265aaa) on Medium.- [Webpush](https://github.com/laravel-notification-channels/webpush) package is used by this app.