kreait/firebase-bundle
Symfony bundle integrating the Firebase Admin PHP SDK. Configure service accounts and access Firebase services (Auth, Firestore/Database, Messaging, Storage) via Symfony’s DI and configuration, with support for modern Symfony setups (Flex or manual).
kreait/firebase-php) remains the technically sound foundation.Illuminate\Cache), making it feasible to integrate without deep Symfony dependencies.config/firebase.php.AppCheck service in Laravel’s AppServiceProvider alongside existing Firebase services.cacheKeyset() method for the AppCheck service.| Risk Area | Updated Assessment | Mitigation Strategy |
|---|---|---|
| Dependency Conflicts | No new Symfony-specific dependencies introduced. Risk remains low for core Firebase features. | Monitor composer why-not for conflicts post-update. |
| DI Container Mismatch | AppCheck cache support may rely on Symfony’s CacheInterface. |
Use Laravel’s Illuminate\Contracts\Cache\Store interface to wrap Symfony’s cache. |
| Event System Gaps | Unchanged. AppCheck cache is likely a standalone feature without event hooks. | No action required unless future releases introduce event-based cache invalidation. |
| Configuration Overhead | New appcheck.keyset_cache config options in Symfony may need translation. |
Publish a Laravel-compatible config file with default values for the new feature. |
| Testing Complexity | AppCheck cache interactions may require mocking Symfony’s cache. | Use Laravel’s Mockery to stub cache stores or test with a real cache driver. |
spatie/laravel-firebase (if available) to avoid reinventing the wheel.kreait/firebase-php@^6.1:
composer require kreait/firebase-php:^6.1
use Kreait\Firebase\AppCheck;
use Illuminate\Support\Facades\Cache;
$appCheck = (new Factory())
->withServiceAccount($config['firebase.service_account'])
->createAppCheck();
// Custom keyset cache wrapper
$keyset = Cache::remember('firebase_appcheck_keyset', now()->addHours(1), function () use ($appCheck) {
return $appCheck->getKeyset();
});
// In FirebaseServiceProvider.php
public function register()
{
$this->app->singleton(AppCheck::class, function ($app) {
$factory = (new Factory())
->withServiceAccount($app['config']['firebase.service_account']);
$appCheck = $factory->createAppCheck();
// Use Laravel's cache for keyset
$keyset = Cache::get('firebase_appcheck_keyset');
if (!$keyset) {
$keyset = $appCheck->getKeyset();
Cache::put('firebase_appcheck_keyset', $keyset, now()->addHours(1));
}
return $appCheck;
});
}
| Component | Updated Compatibility Notes |
|---|---|
| PHP Version | Requires PHP 8.1+ (no change). |
| Laravel Version | Tested on Laravel 10.x; ensure cache drivers are compatible with Symfony’s CacheInterface. |
| Composer Dependencies | No new conflicts introduced. Monitor for symfony/cache if using the bundle directly. |
| Firebase SDK | AppCheck cache feature is fully supported in kreait/firebase-php@^6.1. |
| Caching | Laravel’s cache drivers (Redis, file, database) can replace Symfony’s cache for keyset storage. |
appcheck.keyset_cache.kreait/firebase-php regularly but pin minor/patch versions in composer.json.symfony/cache only if using the bundle directly.Cache::forget() or Cache::put() to manually test cache invalidation.Log::debug('AppCheck keyset cache hit', ['hit' => Cache::has('firebase_appcheck_keyset')]);
How can I help you explore Laravel packages today?