Laravel + FCM Example
This project purposely created for Laratalk #5 on Real-time Webapp using JavaScript Firebase Cloud Messaging API. Refer the Preseentation here
It is basically a simple report monitoring with maps. So, user will submit the report and the page will autmatically updated.
Requirement
- PHP 5.6.4+ for Laravel 5.4
- WebPush API only working on Chrome: 50+, Firefox: 44+, Opera Mobile: 37+ (supports Service worker)
Setup
- Run
composer install
- Copy
env.example
to.env
and add your DB details - Migrate database
php artisan migrate
- Go to Firebase Console and add new project
- Click on Setting icon > Project Setting > Cloud Message and copy the
Legacy server key
to be added in .env asFIREBASE_KEY
. Also updatemessagingSenderId
inpublic/firebase-messaging-sw.js
- Now you are ready to Go!. Take a look at route
/
for simulating Realtime Dashboard Report and/report/submit
to add new report.
Todo
- Js code refactor
- Implement tests
License
This project is licensed under the MIT license.