Download the PHP package blutrixx/nativephp-fcm without Composer

On this page you can find all versions of the php package blutrixx/nativephp-fcm. 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 nativephp-fcm

Blutrixx FCM

A NativePHP Mobile plugin for Firebase Cloud Messaging (FCM) push notifications on Android. Handles requesting notification permission, retrieving/refreshing the FCM registration token, and receiving + displaying incoming pushes (foreground and background). Sending pushes is your app's own job — this package only handles the device side.

Composer package: blutrixx/nativephp-fcm Repo: joelnjoshkibona/nativephp-fcm Current release: v1.0.0 — verified end-to-end on a real Android device (device registered a live FCM token with a real backend, a real push sent via the FCM HTTP v1 API was received and displayed).

Requirements

Installation

Not on Packagist yet.

As a git submodule (how this repo itself consumes it):

Without a submodule:

Laravel auto-discovers FcmServiceProvider. There's no facade — see How the bridge works for why.

How the bridge works

All three bridge functions are synchronous — no async download/progress lifecycle like nativephp-mobile-updater. There's no PHP facade because nothing here has a meaningful server-side equivalent to call; every method is invoked directly from JS via BridgeCall.

Incoming pushes are handled entirely native-side by NativePHPFirebaseMessagingService (Android's FirebaseMessagingService) — there's no PHP involvement in receiving/displaying a push. A new/refreshed FCM token during RequestPermission fires a TokenGenerated event the same way nativephp-mobile-updater's download events work (matching by .endsWith() on the event name — see that package's README for the exact JS listener pattern).

A data-only push with type=gateway_wake starts blutrixx/nativephp-telephony-gateway's TelephonyGatewayService with its ACTION_POLL_NOW action if that plugin is registered in the same app; otherwise it is logged at debug level and ignored. The coupling is by class-name string only, so this package builds and runs without telephony-gateway.

API reference

Method Sync? Returns Notes
GetToken() Sync {token: string} Reads the current FCM token. Falls back to the last token cached in SharedPreferences (by onNewToken) if the live Firebase call fails.
RequestPermission() Sync (blocks on token fetch) {token: string} Requests POST_NOTIFICATIONS (Android 13+) if not already granted, then fetches/caches the FCM token and dispatches TokenGenerated once available.
CheckPermission() Sync {status: 'granted' \| 'denied'} Checks current permission state without requesting it.

Sending pushes (not this package's job)

This package never talks to Firebase's send API — that's a server-side concern with its own service-account credential, entirely separate from google-services.json (which only configures the client). Your backend needs its own FCM HTTP v1 API integration (or a library like kreait/firebase-php) to actually deliver a push to a token this package retrieved.

Quick start: full push flow

The pattern this package's own test app (MOBILE_APP) uses, end to end — request permission + register the token after login, then re-register automatically whenever FCM rotates the token:

A device-token registration endpoint isn't part of this package (it's ordinary backend CRUD — match a token to a user, deactivate it on a failed send) — the shape above is what this test app's UserDeviceTokensModel/DeviceTokenController implement, one reasonable way to do it.

Android manifest impact


All versions of nativephp-fcm with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
nativephp/mobile Version ^3.3
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 blutrixx/nativephp-fcm contains the following files

Loading the files please wait ...