Weave Code
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

kreait/laravel-firebase

Laravel integration for the Firebase PHP Admin SDK. Configure via FIREBASE_ env vars using a service account JSON or array credentials, then access Firebase services in your app. Supports multiple Firebase projects and common Laravel workflows.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Firebase Integration as a Core Feature:

    • Enables authentication, real-time databases (Firestore/Realtime), storage, and messaging natively in Laravel apps.
    • Supports multi-tenant architectures via tenant-aware Firebase projects (e.g., SaaS platforms with isolated Firebase instances per customer).
    • Build vs. Buy: Avoids reinventing Firebase SDK wrappers, leveraging battle-tested Kreait’s PHP SDK with Laravel-native abstractions.
  • Roadmap Priorities:

    • Phase 1: Auth + Firestore for MVP (user management + real-time features).
    • Phase 2: Storage (file uploads) + Cloud Messaging (push notifications).
    • Phase 3: Dynamic Links (deep linking) + AppCheck (security).
    • Multi-project support: Critical for scaling to multiple Firebase projects (e.g., staging/prod environments).
  • Use Cases:

    • User Authentication: Passwordless login, OAuth, or custom token flows.
    • Real-Time Data: Chat apps, live dashboards, or collaborative tools.
    • File Storage: Profile pictures, user-generated content, or backups.
    • Analytics/Logging: Firebase Analytics integration via HTTP middlewares.
    • Serverless Backends: Offload auth/storage logic to Firebase while keeping Laravel for business logic.
  • Cost Optimization:

    • Shared Credentials: Centralize Firebase service accounts (e.g., GOOGLE_APPLICATION_CREDENTIALS) to avoid per-environment setup.
    • Token Caching: Reduces API calls to Firebase’s auth servers (configurable via Symfony Cache).
  • Security:

    • AppCheck Integration: Validate client requests against Firebase’s security rules.
    • Environment-Based Config: Use .env for credentials (never hardcoded) and restrict IAM roles to least privilege.

When to Consider This Package

Adopt This Package If:

  • Your Laravel app requires Firebase services (Auth, Firestore, Storage, etc.) and you want native Laravel integration (dependency injection, facades, config).
  • You need multi-project support (e.g., dev/staging/prod Firebase instances) without manual SDK instantiation.
  • Your team prefers PHP 8.3+ and Laravel 10+ (or newer).
  • You want built-in security (AppCheck, token caching) and observability (HTTP request logging).
  • You’re building a SaaS product with multi-tenancy (tenant-aware Firebase projects).

Look Elsewhere If:

  • You’re using Laravel <10 or PHP <8.3 (package drops support for older versions).
  • You need Firebase Client SDK (for frontend/web apps) — this is a server-side Admin SDK wrapper.
  • You require custom Firebase features not exposed by the underlying kreait/firebase-php SDK (e.g., experimental APIs).
  • Your team prefers alternative backends (e.g., Supabase, AWS Amplify) or self-hosted Firebase equivalents.
  • You’re constrained by Google Cloud quotas or need fine-grained cost controls (this package doesn’t abstract billing).

Alternatives to Evaluate:

  • Custom Wrapper: If you need unique Firebase features, consider wrapping kreait/firebase-php directly.
  • Supabase: For PostgreSQL + Auth/Storage, if you want to avoid Google’s ecosystem.
  • AWS Amplify: If your stack is AWS-centric.
  • Direct SDK: If you’re not using Laravel and want minimal overhead.

How to Pitch It (Stakeholders)

For Executives (Business/Strategy):

*"This package lets us integrate Firebase’s powerful backend services (auth, real-time data, storage) into our Laravel app with minimal dev effort. It’s like having Google’s infrastructure team on call—without the ops overhead.

  • Why? Firebase handles scaling, security, and compliance for us (e.g., GDPR, HIPAA via Google’s tools). We avoid building and maintaining these systems in-house.
  • ROI: Faster time-to-market for features like user auth, live updates, or file storage. Example: Launch a chat app in weeks, not months.
  • Cost: Pay-as-you-go for Firebase usage, with no upfront server costs. The package itself is free (MIT license).
  • Risk Mitigation: Uses a mature, widely adopted SDK (1M+ monthly downloads) with Laravel-native abstractions.

Ask: Approve budget for Firebase services and allocate 1–2 dev days to integrate this package. We’ll start with Auth + Firestore for MVP, then expand."*


For Engineering (Tech/Architecture):

*"This is a drop-in Laravel package for Firebase’s Admin SDK, solving:

  1. Boilerplate: No manual SDK initialization—just composer require and config/firebase.php.
  2. Multi-Project Support: Manage dev/staging/prod Firebase projects via config (critical for CI/CD).
  3. Security: Built-in AppCheck, token caching, and IAM-friendly credential handling.
  4. Observability: Log Firebase HTTP requests to Laravel’s logging channels.

Key Features:

  • Auth: User management, custom tokens, OAuth.
  • Firestore/Realtime DB: Real-time sync for live apps.
  • Storage: File uploads with signed URLs.
  • Messaging: Push notifications via FCM.
  • Multi-Tenancy: Tenant-aware Firebase projects (e.g., FIREBASE_AUTH_TENANT_ID).

Implementation Plan:

  1. Week 1: Set up Firebase projects + credentials (.env or config array).
  2. Week 2: Integrate Auth (e.g., Firebase::auth()->createCustomToken()).
  3. Week 3: Add Firestore for real-time data (e.g., Firebase::firestore()->collection('users')).
  4. Ongoing: Expand to Storage/Messaging as needed.

Dependencies:

  • PHP 8.3+, Laravel 10+ (or newer).
  • Google Cloud project with enabled Firebase services.

Alternatives Considered:

  • Custom SDK wrapper: More work, less maintainable.
  • Direct kreait/firebase-php: Lacks Laravel integrations (facades, config).

Next Steps:

  • Approve Firebase setup (IAM roles, billing).
  • Allocate time for integration (prioritize Auth + Firestore first).
  • Monitor costs via Google Cloud Console."*

For Developers (Hands-On):

*"Here’s how to get started in 10 minutes:

  1. Install:

    composer require kreait/laravel-firebase
    php artisan vendor:publish --provider="Kreait\Laravel\Firebase\ServiceProvider" --tag=config
    
  2. Configure:

    • Add Firebase credentials to .env (e.g., FIREBASE_CREDENTIALS=storage/app/firebase.json).
    • Set FIREBASE_DATABASE_URL (e.g., https://your-project.firebaseio.com).
  3. Use It:

    • Auth:
      $user = Firebase::auth()->createUser(['email' => 'user@example.com', 'password' => 'secret']);
      
    • Firestore:
      $doc = Firebase::firestore()->collection('posts')->document('1')->set(['title' => 'Hello']);
      
    • Multi-Project:
      $stagingAuth = Firebase::project('staging')->auth();
      

Pro Tips:

  • Debugging: Enable HTTP logging in config/firebase.php (http_debug_log_channel).
  • Security: Use GOOGLE_APPLICATION_CREDENTIALS for production (never commit JSON files).
  • Performance: Cache tokens with Symfony Cache ('cache' => 'array' in config).

Docs:

Need Help? Slack the team or check the GitHub Issues."*

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.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony