- How do I install tomatophp/fcm-notifications in a Laravel app?
- Install it with composer require tomatophp/fcm-notifications, then confirm the service provider registration and publish any config file described in the README. Make the Firebase service account JSON available to the runtime through an environment variable or a mounted secret rather than committing it. After that, add the FCM channel to the via() array of the notification you want to deliver and send a test push to a real device.
- Does it use the FCM HTTP v1 API or the deprecated legacy server key?
- The package description does not state which FCM API generation it targets, and that is the first thing to verify before adopting it. Google retired the legacy server-key endpoint in mid-2024, so a driver built around a static server key would be dead on arrival, while one using OAuth2 against the HTTP v1 endpoint is viable. Inspect the source for the endpoint URL and credential flow, or run a single end-to-end send during a spike, before committing.
- Which Laravel and PHP versions does tomatophp/fcm-notifications support?
- Read the composer.json constraints for laravel/framework and php, because the only release dates from March 2024 and may not cover your current Laravel major or the next one. It is aimed at modern Laravel applications on PHP 8.1 or newer, but confirm that against your actual stack rather than assuming. If the constraint is too tight, you can widen it in a fork or avoid adopting the package.
- How should I store and load the Firebase service account credentials?
- Keep the service account JSON out of version control and supply it via an environment variable or a secret mounted into both your web and queue worker containers. The overview does not document which input formats the package accepts, so check whether it expects a file path, a decoded array, or a base64 blob. Also check whether it reuses OAuth tokens across sends or mints a new one per request, since that affects latency at volume.
- Can I send FCM notifications through Laravel's via() channel system?
- Yes. The package is a Laravel notification channel driver, so you add its channel to the via() array of a notification class and implement the message method it expects. That lets you send FCM alongside mail and database channels from the same notification without leaking transport code into your domain layer. It is an outbound-only integration with no schema changes, routes, or middleware.
- Does it support topic messaging, multicast sends, and data-only payloads?
- The package blurb focuses on device tokens and user targeting and does not confirm support for topic messaging, multicast batches, or data-only payloads with priority and TTL. Check the message builder source to see which FCM payload fields it actually exposes before relying on any of them. If you need topic fan-out or batch sends, plan to add that logic yourself or drop to a lower-level Firebase SDK.
- Is tomatophp/fcm-notifications production ready and well maintained?
- Be cautious. It has zero stars, zero dependents, a single release from March 2024, and effectively a bus factor of one, so there is no production track record or issue history to learn from. Its real value is roughly 100 to 200 lines of FCM glue you could own outright. Adopt it only if it saves genuine time and you are prepared to fork and maintain it.
- How does it handle invalid device tokens and FCM error responses?
- Error surfacing is not documented in the overview, so verify whether FCM failures arrive as typed exceptions, Laravel's NotificationFailed event, or are simply caught and logged. Equally important is whether invalid or unregistered tokens are reported so you can prune them, and whether retryable errors are distinguished from terminal ones. If failures are swallowed, wrap the channel or route sends through your own boundary so you keep visibility.
- What are the alternatives to tomatophp/fcm-notifications?
- The two common options are laravel-notification-channels/fcm, a maintained community channel, and using kreait/firebase-php directly, which gives full FCM HTTP v1 coverage at the cost of more code. This package also pulls in a Google auth dependency, so compare the footprint before choosing. The safest pattern is to define your own PushSender interface and keep the package as one swappable implementation.
- Does it work with queued notifications and how do I test it?
- FCM delivery is network I/O, so implement ShouldQueue on your notification and let a queue worker handle it off the request path. There is no evidence of a test suite in the package, which means you should mock the transport yourself rather than depend on its tests. Use Laravel's HTTP client fakes or a fake implementation of your own PushSender interface so application tests never hit FCM.