pushinbr / pam-native-firebase
Production Firebase Analytics, Remote Config, Messaging, Crashlytics and multi-app integration for PAM Native.
Package info
github.com/push-in/pam-native-firebase
Type:pam-native-plugin
pkg:composer/pushinbr/pam-native-firebase
Requires
- php: ^8.5
- pushinbr/pam-native: ^0.8 || ^0.9 || ^0.10 || ^1.0
Requires (Dev)
- pushinbr/pam-native-testing: ^0.2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-19 18:48:07 UTC
README
The Firebase services mobile teams need, behind PAM-native contracts.
Connect Analytics, Crashlytics, Remote Config, Messaging and Installations without coupling application code to vendor SDK objects.
Install · Quick example · Platforms · Permissions · Privacy · API · Docs · Issues
Install
Inside a PAM Native project, add only this capability:
pam composer require pushinbr/pam-native-firebase pam doctor --fix
Android reads .pam/google-services.json through the PAM host; Apple uses the official Firebase Swift Package products. pam composer require updates the normal composer.json and composer.lock, and pam doctor --fix refreshes the generated native integration. Use pam packages to inspect the official capabilities. New to PAM? Create a project with pam init my-app --template native (see the PAM Native overview).
Quick example
use Pam\Native\Firebase\Firebase; use Pam\Native\Firebase\FirebaseOperationState; use Pam\Native\Firebase\RemoteFetchResult; $firebase = new Firebase(); $firebase->logEvent('checkout_completed', [ 'order_id' => $order->id, 'amount' => $order->total, ], static function (FirebaseOperationState $state, ?string $error): void { // Handle native acceptance or failure. }); $firebase->fetchRemoteConfig(static function (RemoteFetchResult $result): void { // Activated, fetched, throttled, or failed. });
Official Firebase integration for PAM Native: multi-app configuration, Analytics, Remote Config, Messaging token lifecycle, Installations and Crashlytics. Named apps can also be configured at runtime with FirebaseAppOptions. Incoming notification presentation and routing remain owned by PAM Native's notification capability; this package owns Firebase token and service APIs.
Platform support
| Platform | Support | Notes |
|---|---|---|
| Android | API 26+ | Pinned main Firebase modules (Analytics 23.2.0, Config 23.1.0, Crashlytics 20.1.0, Messaging 25.1.1), not the discontinued KTX artifacts |
| iOS | 15.0+ | firebase-ios-sdk 12.17.0 Swift Package: FirebaseAnalyticsCore, Core, Crashlytics, Installations, Messaging, RemoteConfig |
| PAM Native | 0.8.0 to < 2.0.0 | From pam-native.plugin.json; PHP 8.5+ |
Permissions and requirements
| Platform | Declared by the plugin |
|---|---|
| Android | android.permission.ACCESS_NETWORK_STATE, android.permission.INTERNET, android.permission.WAKE_LOCK |
| iOS | No usage descriptions |
The default app needs .pam/google-services.json (Android) and the Apple Firebase configuration. Platform SDKs, credentials, entitlements, physical hardware and store configuration remain application responsibilities.
Privacy: no IDFA
On iOS the plugin links the FirebaseAnalyticsCore Swift product (GoogleAppMeasurementCore), not FirebaseAnalytics, which also pulls GoogleAppMeasurementIdentitySupport (IDFA) and GoogleAdsOnDeviceConversion. logEvent, setUserId and setUserProperty work the same without them; no API of this plugin needs IdentitySupport. An app that does want IDFA-based attribution adds the FirebaseAnalyticsIdentitySupport product itself (an explicit opt-in that also requires App Tracking Transparency).
What you can build
- Product analytics and conversion events
- Crash diagnostics with application context
- Push messaging and remotely controlled behavior
| Native path | Firebase Android SDK · Firebase Apple SDK |
| Application model | Composer package + generated native integration |
| Design rule | Independent module; no feed, vertical or application template bundled |
API guide
| API | Responsibility |
|---|---|
Firebase |
Configure apps and access Analytics, Remote Config, Messaging, Installations and Crashlytics. |
FirebaseAppOptions |
Configure named Firebase applications. |
RemoteFetchResult |
Typed Remote Config fetch/activation result. |
Firebase::remoteValue() |
Read one provider-neutral Remote Config document. |
Firebase deliberately does not depend on the feature-flags, sync, HTTP or any other PAM Native plugin. Compose capabilities in application code: pass the string returned by remoteValue() to whichever independent consumer you chose.
All coded states, kinds and variants are sequential integer-backed enums. Use enum cases in application code; do not depend on raw wire numbers.
Production checklist
- Use platform configuration files for the default app and runtime options only for named apps.
- Keep notification routing in PAM Native and Firebase token ownership in this package.
- Never place service-account or server credentials in the mobile bundle.
- Run
pam doctor,pam test, and a signed release build on every supported platform. - Exercise denial, cancellation, backgrounding, process restart and offline behavior before release.
Troubleshooting
- Default app is missing: confirm
.pam/google-services.jsonand the Apple configuration are present. - Events do not appear immediately: Firebase Analytics delivery is intentionally buffered.
- Remote Config is throttled: respect
RemoteFetchResultand the minimum interval. - Native integration is stale: run
pam doctor --fix, rebuild the native host, and inspect the first reported diagnostic.
Security vulnerabilities should be reported through the repository security policy or GitHub private vulnerability reporting, not a public issue.
Docs
Part of the PAM ecosystem
PAM runs PHP natively on servers, desktops and phones. This repository is one piece of it.
| PAM | PAM Desktop | PAM Native | Ecosystem |
|---|---|---|---|
| the runtime and CLI | native desktop apps in PHP | native Android and iOS apps in PHP | every official package and plugin |
Docs: push-in.github.io/pam-docs · Issues
Apache License 2.0 · Made in Brazil by Pushin