google/cloud-firestore
Idiomatic PHP client for Google Cloud Firestore. Install via Composer, authenticate with Google Cloud credentials, and use the generated FirestoreClient (gRPC required) to read/write documents and collections with robust error handling and API docs support.
User::where('active', true) to Firestore’s CollectionReference->where()).gcloud CLI or admin SDK.hasMany/belongsTo, necessitating application-layer logic for joins.Post->comments->replies) map to Firestore’s subcollections?php artisan migrate) adapt to Firestore’s schema-less model?FirestoreClient as a singleton).laravel-firestore) require manual integration. May conflict with existing packages (e.g., spatie/laravel-activitylog).config/firestore.php for credentials and connection pooling.// app/Providers/FirestoreServiceProvider.php
public function register()
{
$this->app->singleton(FirestoreClient::class, function () {
return new FirestoreClient([
'projectId' => config('firestore.project_id'),
'keyFilePath' => config('firestore.key_file'),
]);
});
}
queue:work to sync Firestore writes to SQL for reporting.UserDocument extending a base FirestoreModel).CollectionReference->where() instead of Model::query()).gcloud firestore databases update.laravel-scout, spatie/laravel-permission) will need replacements (e.g., Firestore Scout drivers).package:discover to override package behaviors (e.g., redirect Scout to Firestore).// app/Providers/AuthServiceProvider.php
protected function boot()
{
Auth::provider('firestore', function ($app) {
return new FirestoreAuthProvider();
});
}
DatabaseMigrations with Firestore’s in-memory testing mode or mock the SDK (e.g., Mockery for FirestoreClient).pecl install grpc).composer.json and configure Laravel’s config/firestore.php.FirestoreModel trait for CRUD operations.firestore:document-updated).cache()->remember()).firestore.rules files).gcloud firestore indexes list and CI/CD pipelines to validate rules on deploy.keyFilePath in v1.54.1).composer.json to avoid unexpected updates:
"google/cloud-firestore": "^2.0"
firestore-emulator for local rule testing.roles/datastore.user).debugbar to log Firestore queries and performance metrics.gcloud CLI).Cache::remember).DocumentBatchHow can I help you explore Laravel packages today?