Download the PHP package amdadulhaq/fcm-laravel without Composer

On this page you can find all versions of the php package amdadulhaq/fcm-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package fcm-laravel

FCM (Firebase Cloud Messaging) for Laravel

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads PHP Version Laravel Version Sponsor

A simple, lightweight, fast Firebase Cloud Messaging (FCM) notification channel for Laravel. No Firebase Admin SDK, no bloat — just push notifications, configurable, with a fake for testing.

Requirements

Installation

The service provider is auto-discovered. Publish the config file:

Configuration

Set FIREBASE_CREDENTIALS to the path of your Firebase service account JSON file (download it from Project settings → Service accounts in the Firebase console). The Firebase project ID is read from that file automatically — nothing else is required to start sending.

See config/fcm.php for every option:

Option Env Default Purpose
credentials FIREBASE_CREDENTIALS — Path to the service account JSON. Absolute or relative to the app base path.
http.timeout FCM_HTTP_TIMEOUT 10 HTTP timeout (seconds) for the send request.
android.priority FCM_ANDROID_PRIORITY normal Default for every message's android payload. Set to null to omit. A notification can override it for itself alone — see Notifications.
android.channel_id FCM_ANDROID_CHANNEL_ID default_channel Android notification channel ID. Set to null to omit. A notification can override it for itself alone too.
apns.priority FCM_APNS_PRIORITY — Sets apns.headers.apns-priority (5 or 10). Omitted from the payload unless set.
debug FCM_DEBUG APP_DEBUG Logs skipped sends, rejected tokens, and delivery failures. Independent of the host app's app.debug.
log_channel FCM_LOG_CHANNEL — Log channel debug messages are written to. Defaults to the app's default channel.
dry_run FCM_DRY_RUN false Builds and logs the message but never calls the FCM API; sendToToken() returns true as if it succeeded. Handy for local/staging.

Notifications

Implement toFcm() on any notification, have it implement HasFcmPayload, and route it through the fcm channel:

Return an optional priority ('high' or 'normal') and/or channel_id to override config('fcm.android.priority') and config('fcm.android.channel_id') for that one notification, leaving every other notification on the configured default:

channel_id only changes which Android notification channel the OS delivers into — the app must still create that channel itself (flutter_local_notifications's createNotificationChannel, or NotificationManager.createNotificationChannel on native Android) with whatever importance/sound it wants; this package only stamps the outgoing message with the channel's ID.

The channel resolves device tokens via Laravel's standard routeNotificationFor('fcm', $notification) convention. Add a routeNotificationForFcm() method to the notifiable:

Sends to a token that FCM reports as unregistered or invalid throw internally and are reported through the AmdadulHaq\Fcm\Events\FcmTokenRejected event instead of stopping delivery to the notifiable's other tokens — listen for it to prune the dead token from wherever you store them:

Sending directly

For a one-off send outside the notification system, use FcmService directly:

Testing

Use FcmService::fake() to swap the real service with an in-memory fake and assert on what would have been sent, without dispatching anything or hitting the network:

$fake->rejectToken($token) makes sends to that token throw FcmUnregisteredTokenException (without a real FCM error response), so you can exercise the FcmTokenRejected pruning path in tests.

Running the package's own test suite

License

MIT. See LICENSE.md.


All versions of fcm-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2|^8.3|^8.4|^8.5
google/auth Version ^1.53
illuminate/notifications Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package amdadulhaq/fcm-laravel contains the following files

Loading the files please wait ...