PHPackages                             danyal.a.butt/laravel-fcm - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. danyal.a.butt/laravel-fcm

ActiveLibrary[HTTP &amp; Networking](/categories/http)

danyal.a.butt/laravel-fcm
=========================

Laravel Package for Google Firebase Cloud Messaging V1 API

v1.0.0(1y ago)00MITPHPPHP &gt;=8.2

Since May 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/danyal14/danyaldk-laravel-fcm)[ Packagist](https://packagist.org/packages/danyal.a.butt/laravel-fcm)[ RSS](/packages/danyalabutt-laravel-fcm/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Laravel FCM
===========

[](#laravel-fcm)

A Laravel package for Firebase Cloud Messaging (FCM) that simplifies sending push notifications to Android and iOS devices. Installation

To install the package, run the following command:

```
 composer require danyaldk/laravel-fcm
```

Configuration
-------------

[](#configuration)

### Environment Variables

[](#environment-variables)

Add the following environment variables to your .env file. These variables are required for authenticating with Firebase:

### Service Provider

[](#service-provider)

The package will be automatically discovered by Laravel. If you are using Laravel 5.4 or below, you need to manually register the service provider in config/app.php:

```
'providers' => [
    // Other service providers...
    DanyalDK\LaravelFCM\LaravelFCMServiceProvider::class,
],

```

Usage
-----

[](#usage)

### Sending Notifications

[](#sending-notifications)

You can send notifications to Android and iOS devices using the NotificationSender class.

Example: Sending an Android Notification

```
use DanyalDK\LaravelFCM\Services\FCM\NotificationSender;

$response = NotificationSender::send(
    'android',
    'your-device-token',
    'Test Title',
    'Test Body',
    'https://example.com'
);

if (isset($response['success']) && $response['success']) {
    echo "Notification sent successfully!";
} else {
    echo "Failed to send notification.";
}

```

Example: Sending an iOS Notification

```
use DanyalDK\LaravelFCM\Services\FCM\NotificationSender;

$response = NotificationSender::send(
    'ios',
    'your-device-token',
    'Test Title',
    'Test Body',
    'https://example.com'
);

if (isset($response['success']) && $response['success']) {
    echo "Notification sent successfully!";
} else {
    echo "Failed to send notification.";
}

```

### Handling Errors

[](#handling-errors)

The send method returns a response array. You can check for errors and handle them accordingly:

```
$response = NotificationSender::send(
    'android',
    'your-device-token',
    'Test Title',
    'Test Body',
    'https://example.com'
);

if (isset($response['error'])) {
    echo "Error: " . $response['error'];
} else {
    echo "Notification sent successfully!";
}

```

### Contributing

[](#contributing)

If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request on GitHub.

### License

[](#license)

This package is open-source software licensed under the MIT license. This README.md file provides a comprehensive guide for end users, covering installation, configuration, usage, error handling, testing, contributing, and licensing. Make sure to replace placeholder values with actual information relevant to your Firebase project.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance50

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

367d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b16b0ca2ad876ae3cdc7210f174180565211cd24d94bba3b12d1b8715f2a3438?d=identicon)[danyal14](/maintainers/danyal14)

---

Top Contributors

[![danyal14](https://avatars.githubusercontent.com/u/4901789?v=4)](https://github.com/danyal14 "danyal14 (8 commits)")

### Embed Badge

![Health badge](/badges/danyalabutt-laravel-fcm/health.svg)

```
[![Health](https://phpackages.com/badges/danyalabutt-laravel-fcm/health.svg)](https://phpackages.com/packages/danyalabutt-laravel-fcm)
```

###  Alternatives

[binaryk/laravel-restify

Laravel REST API helpers

651399.1k](/packages/binaryk-laravel-restify)[namu/wirechat

A Laravel Livewire messaging app for teams with private chats and group conversations.

54324.5k](/packages/namu-wirechat)[lomkit/laravel-rest-api

A package to build quick and robust rest api for the Laravel framework.

59152.2k](/packages/lomkit-laravel-rest-api)[wirechat/wirechat

A Laravel Livewire messaging app for teams with private chats and group conversations.

5434.7k](/packages/wirechat-wirechat)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[georgeboot/laravel-echo-api-gateway

Use Laravel Echo with API Gateway Websockets

10435.5k](/packages/georgeboot-laravel-echo-api-gateway)

PHPackages © 2026

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