Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Firebase Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

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.

Architecture fit

  • Thin glue, not a platform component. The package's entire job is booting the kreait Admin SDK from Laravel config: publishable 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.
  • Idiomatically Laravel. Container bindings, config publishing, .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.
  • Right boundary, wrong weight. Capability coverage is genuinely useful (push, token verification, custom claims, Firestore/RTDB). But the value is convenience, and convenience evaporates the moment you need anything the wrapper doesn't expose — newer FCM HTTP v1 features, Firestore query builders, emulator mode.
  • Adoption signal is the headline risk, not the code. 1 star, 0 dependents, single maintainer, last release March 2024 (v1.0.0), score 0.305. Read opportunity 20.88 as "small upside, small artifact" — this is a starter kit you may fork, not a dependency you inherit confidence from.

Integration feasibility

  • Cost is hours, not sprints. Roughly half a day to a working queued push, assuming clean credentials. Install, publish config (verify the tag against the provider), drop the service account JSON outside the web root, set FIREBASE_CREDENTIALS / FIREBASE_PROJECT_ID, clear and re-cache config.
  • The real prerequisite is Firebase console work, not Laravel work: generate the private key, pick the database URL, decide project-per-environment. Budget the calendar time there.
  • One hard blocker to check first: the kreait version the wrapper pins. 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.

Technical risk

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

Key questions to answer before we commit

  1. Is Firebase already the mobile/web platform of record? If yes, this unlocks a near-term backlog (push, claims-based roles, topic management, token pruning). If no, this package must not tip that decision — it's glue, not strategy.
  2. Which exact kreait version does it require, and does that version support our PHP/Laravel targets, FCM HTTP v1, and emulator-based testing?
  3. Who owns it? A named engineer with a fork-and-patch runbook, or we don't adopt.
  4. Is push on a revenue-critical path (auth, payments-adjacent, transactional notices) or additive/re-engagement? Critical-path use requires the interface wrapper and token-pruning discipline from day one.
  5. Single Firebase project or multi-tenant? The wrapper assumes one configured project; simultaneous projects mean hand-rolled Factory instances and a different design.
  6. Do we run Octane or long-lived queue workers, and what is the service-account rotation policy?
  7. Do we actually need Firestore/Realtime DB, or only FCM + token verification? Narrowing the surface narrows the risk.
  8. Where does the service-account JSON live, what's its blast radius, and what's the least-privilege role?

Integration Approach

Stack fit

  • Laravel container + DI contracts is the correct insertion point. Inject 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().
  • Wrap from day one. Define 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.
  • Facade static calls are for tinker only. They are untestable and they leak global state into domain code.

Migration path

There is nothing to migrate to — this is greenfield glue. What matters is the documented exit path, agreed before adoption:

  • Trigger conditions for exit: needed FCM/Firestore features absent from the pinned kreait, emulator testing required, no patch within an agreed SLA, or a kreait major bump that the wrapper blocks.
  • Exit mechanics: fork into 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.
  • Do not attempt multi-project through the wrapper. Build separate Factory instances with withServiceAccount() and register them as named singletons.

Compatibility

  • Pin exactly: "tomatophp/laravel-firebase": "1.0.0", not ^1.0.
  • Confirm the vendor:publish tag against the provider source; README tags are unreliable here.
  • Verify PHP/Laravel support matrix against the resolved kreait version, not against the wrapper's own constraints.
  • Check for and remove any existing kreait/laravel-firebase install before debugging anything else.

Sequencing

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.

Operational Impact

Maintenance

  • Treat this as internal code we happen to not have written yet. Last release March 2024, single maintainer, no dependents. Pin the version, schedule an annual dependency review, and keep the fork runbook current. The failure mode is abandonment, not lock-in — the code is small enough that vendoring is an afternoon, which is why the risk is manageable rather than disqualifying.
  • The transitive kreait dependency is the maintenance surface, not the wrapper. Track it as a first-class dependency with an upgrade owner.

Support

  • No vendor support path. The kreait documentation is the real reference; the wrapper's own docs contain effectively no worked examples. Plan onboarding accordingly: one internal owner who has read the provider source and the kreait docs, and who is the escalation point.
  • Silent credential misconfiguration is the worst support case (wrong project, stale cache, CWD-relative path). Mitigate with explicit startup validation of the credentials path and project id rather than debugging from symptom.

Scaling

  • The singleton binding is good for throughput — connection reuse, token caching. Confirm no hot path constructs a new Factory per request.
  • Batch, don't loop. sendAll() with chunks of 500 (FCM cap). Never send in a request cycle; queue everything with tries and tiered backoff ([10, 60, 300]).
  • Per-worker token caching means horizontal scale is cheap but credential rotation is not instant — rotating service accounts requires a rolling worker restart.

Failure modes to instrument

  • Silent delivery failures — a valid API response for an unregistered or expired token. Detect Unregistered/NotFound, prune the token, and alert; otherwise push looks healthy while users see nothing.
  • Opaque exceptions — Kreait\Firebase\Exception\Messaging\* subclasses vary in specificity. Wrap sends, log the raw message plus a token prefix, and emit a failure-rate metric.
  • Credential resolution — CWD-relative paths, config-cache staleness after .env edits, and private-key \n expansion if credentials ever move to env vars.
  • Config/facade collision with kreait/laravel-firebase producing wrong-credential behavior with no error.
  • Octane/queue workers serving stale credentials until reboot.

Ramp-up

  • Half a day to productive with clean credentials; the non-obvious cost is Firebase console setup plus the absence of worked examples. The team will be reading kreait docs regardless, so factor that into the estimate and skip the wrapper tutorial entirely.
  • Onboarding content that actually matters: use DI not the facade; queue all sends; wrap behind our interfaces; check composer why kreait/firebase-php before upgrading anything.
  • If the PHP/Laravel/kreait version triangle doesn't line up cleanly, skip the wrapper. Direct SDK binding is the same capability with active maintenance, and the ramp-up difference is negligible once the wrapper's convenience is exhausted.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package