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 Firebase Laravel Package

kreait/laravel-firebase

Laravel package integrating the Firebase PHP Admin SDK. Configure via service account credentials, access Firebase services through Laravel-friendly bindings, and support multiple Firebase projects. Maintained under beste org; namespace/package name unchanged.

View on GitHub
Deep Wiki
Context7

kreait/laravel-firebase brings the Firebase PHP Admin SDK to Laravel, providing a clean, Laravel-friendly way to authenticate with a Service Account and access Firebase services from your backend.

Configure credentials via .env (JSON file path or array) and use the SDK through Laravel’s container for straightforward, testable integrations—supporting multiple Firebase projects when needed.

  • Laravel integration for the Firebase Admin SDK
  • Service Account auth via JSON file or array/env config
  • Access to Firebase services (e.g. Auth, Database, Messaging) through the SDK
  • Support for multiple projects in one application
  • Maintained package with CI-tested releases
Frequently asked questions about Laravel Firebase
How do I install kreait/laravel-firebase in a Laravel 13 project?
Run `composer require kreait/laravel-firebase` in your project root. The package auto-discovers Laravel and registers the service provider. No manual configuration is needed beyond setting up Firebase credentials in `.env`. Ensure PHP 8.3+ is used, as the package requires it.
Can I use this package with Laravel 10 or older versions?
The latest version supports Laravel 11–13 only. For Laravel 10, use `kreait/laravel-firebase:^6.2.0`, but this drops PHP 8.2 support. Check the [release notes](https://github.com/beste/laravel-firebase/releases) for version-specific compatibility.
How do I configure Firebase credentials for multiple projects?
Use the `FIREBASE_CREDENTIALS_<project_name>` environment variables or define them in `config/firebase.php` under the `projects` key. Access specific projects via `Firebase::project('project_name')->auth()` or `Firebase::project('project_name')->storage()`.
What’s the best way to handle Firebase credentials in CI/CD (e.g., GitHub Actions)?
Store the JSON credential file in a secrets manager (e.g., GitHub Secrets) and reference it via `FIREBASE_CREDENTIALS=/path/to/file.json` in your CI environment. Avoid hardcoding credentials in `.env` files for security.
How do I mock Firebase services in PHPUnit tests?
Use Laravel’s `Mockery` or the `kreait/firebase-php` mocking utilities. Bind a mock instance to the container in your test setup: `$this->app->instance('firebase', Mockery::mock('overload', Firebase::class));`. Test specific services like `auth()` or `storage()` separately.
Does this package support Firebase Realtime Database or only Firestore?
The package supports both Realtime Database and Firestore through the underlying `kreait/firebase-php` SDK. Access them via `Firebase::project()->database()` or `Firebase::project()->firestore()`, respectively. Check the [SDK docs](https://firebase-php.readthedocs.io/) for feature parity.
What are the performance implications of using Firebase Storage with this package?
Firebase Storage operations are subject to Firebase’s rate limits (e.g., 5MB/s uploads for Spark plan). For high-throughput apps, implement retries with exponential backoff using Guzzle middleware or Laravel’s `retry` helper. Monitor usage via Firebase Console.
How do I switch from the deprecated `FirebaseAuth` facade to the new `Firebase::auth()` syntax?
Replace `FirebaseAuth::createUser()` with `Firebase::auth()->createUser()`. The package deprecates old facades in favor of a unified `Firebase` facade. Run `php artisan vendor:publish --tag=config` to update your config if needed.
Can I use this package with Laravel Queues for async Firebase operations?
Yes, but ensure statelessness by avoiding persistent connections (e.g., Firestore listeners). Use `stateless: true` in your queue worker or configure the Firebase SDK to avoid caching tokens. Test in a distributed environment to validate behavior.
Are there alternatives to kreait/laravel-firebase for Firebase + Laravel integration?
Other options include `spatie/laravel-firebase` (community-driven, less maintained) or direct `kreait/firebase-php` integration. However, `kreait/laravel-firebase` offers tighter Laravel integration (container, facades, multi-project support) and is actively maintained by the `beste` org.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport