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
Cloud Firestore

Cloud Firestore Laravel Package

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.

View on GitHub
Deep Wiki
Context7

google/cloud-firestore is an idiomatic PHP client for Google Cloud Firestore, a scalable NoSQL document database designed for high performance and simple application development. It’s part of the broader Google Cloud PHP ecosystem and provides generated, strongly-typed access to the Firestore API.

Use it to authenticate with Google Cloud, issue Firestore requests, and handle failures cleanly in modern PHP applications.

  • Composer install (composer require google/cloud-firestore)
  • Built on the official Firestore API with up-to-date surface area
  • Requires the gRPC extension for transport
  • Includes reference API docs and samples for common operations
  • Standardized error handling via ApiException
Frequently asked questions about Cloud Firestore
How do I install google/cloud-firestore in a Laravel project?
Run `composer require google/cloud-firestore` in your project directory. Ensure your PHP environment has the gRPC extension enabled, as this package relies on it for communication with Firestore. Check the [gRPC installation guide](https://cloud.google.com/php/grpc) if needed.
What Laravel versions does this package support?
The package itself is framework-agnostic but works with any Laravel 8.x or 9.x project. It integrates with Laravel’s service container, so you can bind the Firestore client as a singleton in your `AppServiceProvider`. No Laravel-specific dependencies are required.
Can I use Firestore as a direct replacement for Laravel Eloquent?
No, Firestore is a NoSQL database, so it lacks Eloquent’s query builder, migrations, and relationship features like `hasMany`. You’ll need to refactor your data model to use Firestore’s document/collection structure and handle relationships manually or via custom repositories.
How do I authenticate with Google Cloud in Laravel?
Use the [Google Cloud PHP authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md). For Laravel, store your service account credentials in `.env` and configure the `FirestoreClient` using Laravel’s configuration system or environment variables.
Does this package support real-time updates for Laravel Livewire or Inertia.js?
Yes, Firestore’s native listeners can push real-time updates to your frontend. Use Firestore’s `onSnapshot` or `onDocumentSnapshot` methods to trigger Livewire/Inertia.js reactivity without polling or custom WebSocket setups.
What are the performance implications of using Firestore in production?
Firestore offers low-latency reads/writes but has eventual consistency. For critical operations (e.g., inventory), consider caching with Redis or implementing retries for failed transactions. Monitor costs via Google Cloud’s Budget Alerts to avoid unexpected charges.
How do I handle nested Laravel relationships (e.g., Post-Comments-Replies) in Firestore?
Use Firestore’s subcollections to model nested data. For example, store comments under a `posts/{postId}/comments` collection and replies under `posts/{postId}/comments/{commentId}/replies`. Denormalize data where needed to avoid complex joins.
Are there alternatives to google/cloud-firestore for Laravel?
For NoSQL in Laravel, consider `spatie/laravel-firestore` (a wrapper for this package) or MongoDB with `jenssegers/laravel-mongodb`. If you need SQL-like features, stick with Eloquent or use a hybrid approach (e.g., Firestore for real-time data, PostgreSQL for transactions).
How do I debug Firestore API errors in Laravel?
Wrap Firestore calls in `try-catch` blocks to handle `ApiException`. Use Google Cloud’s [Debugging guide](https://github.com/googleapis/google-cloud-php/blob/main/DEBUG.md) for logs and enable Firestore’s built-in logging in your Google Cloud console.
Can I use Firestore with Laravel’s queue system or serverless deployments?
Yes, Firestore integrates seamlessly with Google Cloud Functions or Cloud Run for serverless Laravel apps. For queues, use Firestore triggers to process events asynchronously, but ensure your queue workers handle eventual consistency gracefully.
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