kreait/laravel-firebase
Laravel integration for the Firebase PHP Admin SDK. Configure Firebase service account credentials via env/JSON/array, access Firebase services through Laravel’s container/facades, and support multiple Firebase projects in one app.
Pros:
firebase-php SDK, providing a clean, Laravel-centric API for Firebase services (Auth, Firestore, Realtime Database, Storage, etc.).Cons:
firebase-php, so changes in the underlying SDK (e.g., breaking changes in Firebase APIs) may require updates to the package or custom logic.firebase-php (v8.x), which is a mature but externally maintained library. Risks include:
firebase-php updates and test thoroughly during major version bumps.config:cache and environment validation to catch issues early..env files is unsafe..env with Vault or third-party secrets managers.Cache component (v7 or v8) for token caching. Ensure no conflicts with existing Symfony dependencies.composer require kreait/laravel-firebase
php artisan vendor:publish --provider="Kreait\Laravel\Firebase\ServiceProvider" --tag=config
.env with FIREBASE_DATABASE_URL and credentials (JSON file or array).config/firebase.php:
'projects' => [
'default' => [
'database_url' => env('FIREBASE_DATABASE_URL'),
'credentials' => env('FIREBASE_CREDENTIALS') ? json_decode(file_get_contents(env('FIREBASE_CREDENTIALS')), true) : null,
],
'app' => [
'database_url' => env('FIREBASE_APP_DATABASE_URL'),
'credentials' => [...],
],
],
// Old (direct SDK)
$auth = (new Firebase\Auth())->setCredentials(...);
// New (package)
$auth = Firebase::auth(); // Default project
$appAuth = Firebase::project('app')->auth();
How can I help you explore Laravel packages today?