Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Fcm Laravel Package

laravel-notification-channels/fcm

A Laravel notification channel for Firebase Cloud Messaging (FCM). Send push notifications to Android, iOS, and web devices through Laravel's notification system, with support for topics, data payloads, and the FCM HTTP v1 API.

View on GitHub
Deep Wiki
Context7

FCM (Firebase Cloud Messaging) Notifications Driver for Laravel

Frequently asked questions about Fcm
How do I install laravel-notification-channels/fcm in a Laravel app?
Install it with Composer using composer require laravel-notification-channels/fcm. The service provider is auto-discovered, so no manual registration is needed on supported Laravel versions. After installing, publish the package config with php artisan vendor:publish and add your Firebase service account credentials before attempting your first send.
Which Laravel and PHP versions does this package support?
Version 6.x requires Laravel 12 or newer and PHP 8.4 or newer, so it tracks the leading edge of the framework rather than the widest installed base. If your application is still on Laravel 10 or 11, you cannot adopt 6.x and must either upgrade the host app first or stay on the 5.x line. Treat the framework and PHP upgrade as a separate prerequisite workstream when estimating adoption.
How do I send a push notification to a single device?
Create a notification class whose via() method returns FcmChannel, and implement toFcm($notifiable) to build the message. The channel resolves the device token through routeNotificationForFcm() on your notifiable model, so you typically store the FCM token on the user or device record. Then send it with the normal Laravel Notification::send() flow and the package handles the HTTP call.
How does topic messaging work with FcmTopicChannel?
Version 6.0.0 adds FcmTopicChannel, which sends a notification to an FCM topic name instead of individual device tokens, moving fan-out to FCM's subscription model. Clients subscribe and unsubscribe to topics on the device side; your Laravel app just publishes to the topic. Keep in mind topic delivery is best-effort, membership changes are eventually consistent, and there is no per-recipient delivery acknowledgment.
What credentials does the package need and how should I store them?
You need a Firebase service account JSON file, which authenticates requests to the FCM HTTP v1 API using OAuth2. The credential is high-privilege, so keep it in a secrets manager or environment-driven path rather than committing it to the repository or baking it into a container image. The topic channel uses the same credential, so enabling topics does not change your security posture.
Does this package use the legacy FCM API or the HTTP v1 API?
It targets the FCM HTTP v1 API with OAuth2 service account authentication, which is the current Google-supported path after the legacy server key API was retired. Because v1 auth depends on the underlying Firebase and Google auth libraries, verify the pinned dependency versions in the changelog when you upgrade, and audit that transitive tree for advisories and conflicts with other Firebase integrations.
How do I test FCM notifications in Laravel?
Use Notification::fake() and assert that the expected notification was sent to the notifiable, which keeps tests fast and avoids real network calls. Separately unit test your toFcm() method by inspecting the message object it returns, including the android and ios helper blocks. The package is a thin channel, so most logic worth testing lives in your own notification classes.
Can I send custom data payloads and platform-specific options?
Yes. The message class supports data payloads alongside the notification block, so you can deliver key-value data for client-side handling. Version 6.0.0 also adds android and ios helpers on the message class that reduce the chance of a malformed APNs or Android block. These helpers are convenience builders only and do not validate how a device will render the payload.
What are the alternatives to this package?
Common alternatives include using kreait/laravel-firebase directly, calling the FCM HTTP v1 API with your own HTTP client, or hand-rolling a notification channel. This package's advantage is that it plugs into Laravel's existing notification system with minimal code. The trade-off is that it is deliberately thin: it is not a device-token registry, topic subscription manager, fan-out service, or delivery analytics layer, so those remain your responsibility.
Is this package maintained and safe for a production Tier-1 notification path?
The project is volunteer-maintained under the MIT license by a small core team, with a 6.0.0 major release signaling active development, but that is not a vendor SLA. The supported version matrix is narrow, and the 5.x branch will likely receive only limited fixes, so confirm the backport policy and write down a fork-and-patch fallback. Validate adoption with Packagist download trends and commit and issue velocity before committing a critical path to it.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource