tomatophp/laravel-firebase
Laravel Firebase integration for connecting your app to Firebase services with less boilerplate. Includes configuration helpers and a clean API for authentication, Firestore data, and cloud messaging, making it easy to send notifications and sync records from your Laravel or Tomatophp panel.
Bottom line: this is a ~20-line service provider plus a config file wrapped around kreait/firebase-php. Adopt it as an accelerator for FCM push and Firebase ID-token verification if Firebase is already your mobile platform — not as a platform decision, and not on a revenue-critical path without an owner and a fork plan.
config/firebase.php, a service provider binding the client as a singleton, credentials loaded from a service-account JSON path in .env, and facade/DI access to Firestore, Realtime Database, Cloud Messaging, and Auth token verification. Day-to-day code is kreait SDK code..env-driven secrets kept out of VCS, facade ergonomics. This is exactly the shape a feature team expects; there is no architectural novelty and therefore no architectural risk from the wrapper itself.FIREBASE_CREDENTIALS / FIREBASE_PROJECT_ID, clear and re-cache config.composer show tomatophp/laravel-firebase and composer why kreait/firebase-php before committing. If the resolved kreait is too old for our PHP/Laravel versions or for HTTP v1 FCM, skip the wrapper and bind the SDK directly — same capability, actively maintained, and the convenience gap is trivial.| Risk | Likelihood | Impact | Mitigation |
|---|---|---|---|
| Maintainer abandonment / no patches | High (already effectively unmaintained) | Medium | Pin 1.0.0 exactly; fork-and-patch runbook; code is vendorable in an afternoon |
| Upstream kreait major bump breaks us | Medium | Medium | Pin transitive version; annual dependency review; exit to direct binding |
Config/facade alias collision with kreait/laravel-firebase |
Medium | High (silently wrong credentials) | Explicit conflict check at install; never run both |
| Credential path resolves against CLI/queue CWD | Medium | High (intermittent prod failure) | Use storage_path()/base_path() in config, never bare relative paths |
| Stale config cache after credential rotation | Medium | High | Runbook step: config:clear then verify post-config:cache |
| Octane/queue singleton holds rotated creds | Medium | Medium | Document worker restart on rotation; confirm no per-request Factory construction |
Silent FCM failures (Unregistered/NotFound) |
High | Medium | Log raw message + token prefix; prune on those errors; scheduled token validation sweep |
| Facade-driven static calls defeat test mocks | High if unmanaged | Medium | Interface-first: bind PushNotifier before the first feature ships |
Factory instances and a different design.Messaging, Auth, FirestoreClient — resolve the concrete class the provider actually binds by reading src/*ServiceProvider.php, not the README. If contract injection fails, fall back to the registered Firebase/Factory alias and call ->getMessaging().PushNotifier (and equivalents for token verification) in the app, implement with the SDK, bind in AppServiceProvider. Given maturity signals, this is the highest-leverage single decision: swapping to direct kreait/firebase-php or a vendored fork becomes a one-file change.There is nothing to migrate to — this is greenfield glue. What matters is the documented exit path, agreed before adoption:
packages/ and patch in place, or replace the binding with a hand-rolled Factory in AppServiceProvider (~20 lines). Because the app talks to PushNotifier, neither exit touches feature code.Factory instances with withServiceAccount() and register them as named singletons."tomatophp/laravel-firebase": "1.0.0", not ^1.0.vendor:publish tag against the provider source; README tags are unreliable here.kreait/laravel-firebase install before debugging anything else.| Phase | Work | Gate / exit criteria |
|---|---|---|
| 0 — Decision gate | Confirm Firebase as platform primitive; 1-day spike | Publish tag works, binding class confirmed, one FCM send + one token verify against a staging project succeeds |
| 1 — Harden | Interfaces (PushNotifier, TokenVerifier), config via storage_path(), config:cache verification, conflict check |
Feature code has zero direct facade usage; config validated post-cache |
| 2 — First feature | Queued push job with tries/backoff, dispatched from a domain event |
Demoable push in staging; failure logging with token prefix |
| 3 — Identity | ID-token verification middleware → firstOrCreate local user → Laravel session |
Clear "Firebase Auth on client, Laravel as system of record" doc |
| 4 — Expand | Custom claims for roles, topic subscriptions, scheduled stale-token sweep | Ops runbooks written |
| 5 — Exit ready | Fork/vendor runbook rehearsed | A named engineer can swap the implementation in under a day |
Deliberately deferred: multi-project isolation, emulator-based test harness, Firestore data modeling — all of which argue for direct SDK binding rather than the wrapper.
Factory per request.sendAll() with chunks of 500 (FCM cap). Never send in a request cycle; queue everything with tries and tiered backoff ([10, 60, 300]).Unregistered/NotFound, prune the token, and alert; otherwise push looks healthy while users see nothing.Kreait\Firebase\Exception\Messaging\* subclasses vary in specificity. Wrap sends, log the raw message plus a token prefix, and emit a failure-rate metric..env edits, and private-key \n expansion if credentials ever move to env vars.kreait/laravel-firebase producing wrong-credential behavior with no error.composer why kreait/firebase-php before upgrading anything.How can I help you explore Laravel packages today?