yacinediaf/laravel-notifyme

This is my package laravel-notifyme

v1.0.4 2025-05-30 16:39 UTC

This package is auto-updated.

Last update: 2025-05-30 16:40:21 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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

  1. You can install the package via composer:
composer require yacinediaf/laravel-notifyme
  1. 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

  1. 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

  1. Make sure the current user is authenticated.
  2. 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.
  3. Save the generated FCM token for the current user with the current device by Posting to this endpoint /api/save_device_token
  4. 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.