Download the PHP package joydeep-bhowmik/laravel-push-notification without Composer
On this page you can find all versions of the php package joydeep-bhowmik/laravel-push-notification. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download joydeep-bhowmik/laravel-push-notification
More information about joydeep-bhowmik/laravel-push-notification
Files in joydeep-bhowmik/laravel-push-notification
Package laravel-push-notification
Short Description A Laravel package for integrating Firebase Cloud Messaging (FCM) to handle push notifications.
License MIT
Informations about the package laravel-push-notification
Laravel Push Notification (this package is currently under development)
A Laravel package for integrating Firebase Cloud Messaging (FCM) to handle push notifications seamlessly.
Table of Contents
- Installation
- Publishing Assets
- Configuration
- Migrations
- Usage
- Sending Notifications
- Example Notification Class
- Frontend Setup
- Push Notification Switch Component
- License
- Acknowledgments
Installation
To install the package, use Composer:
And add this in your bootstrap/providers
Publishing Assets
After installation, publish the package assets using the following command:
This command will publish the following resources:
- Configuration file:
config/fcm.php
- Firebase service worker:
public/firebase-messaging-sw.js
- Main JavaScript file:
public/js/fcm.js
- Firebase Auth script:
public/js/firebase-auth.js
- UserDevice model:
app/Models/UserDevice.php
- Migration for UserDevice:
database/migrations/
(with a timestamp) - Push notification switch Blade component:
resources/views/components/push-notification-switch.blade.php
Configuration
After publishing, configure the FCM settings in config/fcm.php
. Ensure you set the correct Firebase credentials and other options as needed.
Make sure to set the FIREBASE_CREDENTIALS
in your .env
file.
and replace api keys in public/firebase-messaging-sw.js
,resources/js/fcm.js
,storage/framework/app/firebase-auth.js
.
Migrations
Run the migrations to create the necessary database tables:
Usage
Sending Notifications
To send notifications, create a notification class that uses the FcmChannel
.
Example Notification Class
Here’s how to create a notification class that utilizes the FcmChannel
:
Frontend Setup
Include the necessary JavaScript files in your application to handle push notifications. You can add the following in your main js file:
Make sure to replace the placeholders in your firebaseConfig
in fcm.js
and the service worker:
Push Notification Switch Component
You can use the push-notification-switch
Blade component in your views to allow users to enable or disable push notifications.
License
This package is licensed under the MIT License. See the LICENSE file for more information.
Acknowledgments
All versions of laravel-push-notification with dependencies
kreait/firebase-php Version ^6.0
livewire/volt Version ^1.0