yacinediaf / laravel-notifyme
This is my package laravel-notifyme
Fund package maintenance!
Yacine Diaf
Requires
- php: ^8.2
- illuminate/contracts: ^10.0||^11.0||^12.0
- laravel-notification-channels/fcm: ^5.1
Requires (Dev)
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0||^8.22.0
- phpunit/phpunit: ~11.0
README
This package allows you to notify your users through the firebase cloud messaging technique in order to notify them using there device notification on both IOS or ANDROID with ease.
Before start working with this package it is recommended to read the following article to know how things works under the hood. Notify me! Using Laravel and FCM.
Requirements
You need to have laravel sanctum installed. if you don't installed it yet do it using the following command
composer require laravel/sanctum
Installation
- You can install the package via composer:
composer require yacinediaf/laravel-notifyme
- You can publish and run the migrations with:
php artisan vendor:publish --tag="migrations"
php artisan migrate
Don't forget to add the hasDevice trait to your User model
- Add the FIREBASE_CREDENTIALS to your .env file you can read the following article in order to know where to get this file. Notify me! Using Laravel and FCM.
FIREBASE_CREDENTIALS=storage/app/private/googleaccountservice.json
Usage
- Make sure the current user is authenticated.
- Generate the FCM token on the client side from your mobile client (IOS, ADNROID) by installing firebase package compatible with the language you're using for example Flutter.
- Save the generated FCM token for the current user with the current device by Posting to this endpoint /api/save_device_token
- You need to include in the body parameter of the request the following data:
[ 'user_id' => ['required', 'exists:users,id'], 'device_token' => ['required', 'string'], 'device_info' => ['required', 'string'], //Iphone 15 pro max ];
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.