PHPackages                             quantomtech/laravel-firebase-batch-messaging - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. quantomtech/laravel-firebase-batch-messaging

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

quantomtech/laravel-firebase-batch-messaging
============================================

Laravel package for batch Firebase cloud messaging API

1.0.3(3y ago)06MITPHPPHP &gt;=7.1

Since Jan 15Pushed 3y agoCompare

[ Source](https://github.com/QuantomTech/laravel-firebase-batch-messaging)[ Packagist](https://packagist.org/packages/quantomtech/laravel-firebase-batch-messaging)[ Docs](https://github.com/QuantomTech/laravel-firebase-batch-messaging)[ RSS](/packages/quantomtech-laravel-firebase-batch-messaging/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Batch Messaging using Firebase FCM API
======================================

[](#batch-messaging-using-firebase-fcm-api)

This is based on [Firebase Doc](https://firebase.google.com/docs/cloud-messaging/send-message#send-messages-to-multiple-devices.). Usually, using [Channel](https://laravel.com/docs/8.x/notifications#specifying-delivery-channels) will result in one API call per one message although queued. Considering bulk users with more than thousands, this largely overwhelm API calls. This package implement simple method to send batch max 500 messages per API call.

Installation
------------

[](#installation)

Install using composer :

```
composer require quantomtech/laravel-firebase-batch-messaging

```

Publish config File :

```
php artisan vendor:publish --provider="Quantomtech\LaravelFirebaseBatchMessaging\Providers\FCMBatchServiceProvider"

```

Setup Credentials
-----------------

[](#setup-credentials)

Define Google Service Account JSON path inside .env:

```
FCMB_SERVICE_JSON_BASE_PATH='/var/www/my-laravel-project/service-app-firebase.json'

```

Optional configuration inside .env :

```
# Is the filename for your notification sound file.
FCMB_SOUND="my_custom_noti_sound.wav'

# Is the path to generate temporary file for the package
FCMB_TEMP_FOLDER=

```

Sample Use
----------

[](#sample-use)

Considering 1000 users, 2 batch jobs are queued as Firebase only allow 500 messages max per API call.

SendFCMJob.php to queue tasks :

```
