PHPackages                             tocaan/fcmfirebase - 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. tocaan/fcmfirebase

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

tocaan/fcmfirebase
==================

Allow you to use it send fcm firebase notification

v0.0.2.x-dev(1y ago)21.3k1MITPHPCI failing

Since Jun 24Pushed 1y ago4 watchersCompare

[ Source](https://github.com/Tocaanco/FcmFireBase-package)[ Packagist](https://packagist.org/packages/tocaan/fcmfirebase)[ RSS](/packages/tocaan-fcmfirebase/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (10)Versions (3)Used By (0)

FcmFirebase
===========

[](#fcmfirebase)

[![Tests](https://github.com/spatie/laravel-package-tools/workflows/Tests/badge.svg)](https://github.com/spatie/laravel-package-tools/workflows/Tests/badge.svg)

The package allow to send fcm firebase message

### Installation

[](#installation)

Install via composer:

```
composer require tocaan/fcmfirebase dev-master

```

And add the service provider in config/app.php:

```
Tocaan\\FcmFirebase\\FcmFirebaseServiceProvider,
```

Then register Facade class aliase:

```
'FcmFirebase' => \Tocaan\FcmFirebase\Facades\FcmFirebase::class,
```

### Publish assets:

[](#publish-assets)

```
php artisan vendor:publish

```

### Getting Started

[](#getting-started)

To start use in User Model to enable use FcmChannelTokens and sendForUser in FcmFirebase Facade

- must implements `\Tocaan\FcmFirebase\Contracts\IFcmFirebaseDevice`and use trait `  \Tocaan\FcmFirebase\Traits\FcmDeviceTrait`

```
class User extends Authenticatable implements  \Tocaan\FcmFirebase\Contracts\IFcmFirebaseDevice
{
   use \Tocaan\FcmFirebase\Traits\FcmDeviceTrait
}

```

to send all device token in database can use this

```
 $data = [
        "title" => [
            "ar" => "test",
            "en" => "test"
        ],
        "description" => [
            "ar" => "test",
            "en" => "test"
        ],
        "type"=>"general",
        "id"  => -1
 ];
FcmFirebase::sendToAllDevices($data)`;

```

to send for user can use this (but must handle model User first)

```
 $data = [
        "title" => [
            "ar" => "test",
            "en" => "test"
        ],
        "description" => [
            "ar" => "test",
            "en" => "test"
        ],
        "type"=>"general",
        "id"  => -1
 ];
FcmFirebase::sendForUser($user,$data)`;

```

to register new device tokens can use this method

```
$data = [
'device_token' => "dd"
'user_id'      => "1",
'platform'     => "ANDRIOD",
'lang'         => $data["lang"] // OPTIONAL,
];`
FcmFirebase::registerToken($data)

```

to logout user

```
FcmFirebase::logoutUser($user)

```

to use it in the Notification class can use this channel `FcmChannelTokens` and implement this method `toFcm`

```
     /**
     * Get the notification's delivery channels.
     *
     * @param mixed $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return [FcmChannelTokens::class];
    }

     /**
     * Get the array representation of the notification.
     *
     * @param mixed $notifiable
     * @return array
     */
    public function toFcm($notifiable)
    {
        return [
        "title" => [
            "ar" => "test",
            "en" => "test"
        ],
        "description" => [
            "ar" => "test",
            "en" => "test"
        ],
        "type"=>"general",
        "id"  => -1
        ];
    }

```

To allow debug the response from firebase need to allow this in .env

```
FCM_ALLOW_LOG= true

```

To Disabled init parse SERVICE\_ACCOUNT when init but must call `setServiceAccount` and set path to avoid get exception `serviceAccountNotConfigure`

```
FCM_PARSE_SERVICE_ACCOUNT_IN_INIT= false

```

`setServiceAccount` method allow user to override SERVICE\_ACCOUNT file

To allow morph in device model go to config and change the following config

```
"allow_morph"=> true,
"morph" =>"owner", the morph relation name
"morph_index"=> false, // if need to make morph index

```

To User package in old package will need to follow this step

```
-  instal package
-  remove call this `$this->Push` and use this FcmPush::push($fields, $platform, $lang)

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 Bus Factor1

Top contributor holds 91.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~58 days

Total

2

Last Release

626d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/22634d946ccae8799787bebcd8ea49cb4df8936e767c8acf972d990e3e0e8b8b?d=identicon)[tocaan](/maintainers/tocaan)

---

Top Contributors

[![AhmedSafwat1](https://avatars.githubusercontent.com/u/38819467?v=4)](https://github.com/AhmedSafwat1 "AhmedSafwat1 (33 commits)")[![hemasharshar](https://avatars.githubusercontent.com/u/18012017?v=4)](https://github.com/hemasharshar "hemasharshar (3 commits)")

---

Tags

laravelpackageboilerplateLaravelPackageExample

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tocaan-fcmfirebase/health.svg)

```
[![Health](https://phpackages.com/badges/tocaan-fcmfirebase/health.svg)](https://phpackages.com/packages/tocaan-fcmfirebase)
```

###  Alternatives

[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[tzsk/sms

A robust and unified SMS gateway integration package for Laravel, supporting multiple providers.

320244.3k6](/packages/tzsk-sms)[illuminate/notifications

The Illuminate Notifications package.

483.0M964](/packages/illuminate-notifications)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
