google/cloud-firestore

Cloud Firestore Client for PHP

Package info

github.com/googleapis/google-cloud-php-firestore

pkg:composer/google/cloud-firestore

Statistics

Installs: 4 394 087

Dependents: 45

Suggesters: 8

Stars: 181

v2.1.0 2026-04-28 15:44 UTC

Requires

Suggests

  • ext-protobuf: Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions.

Provides

None

Conflicts

None

Replaces

None

Apache-2.0 029dba99b9c8cdb3dc64e3e8f0e6351d9883bdf7

This package is auto-updated.

Last update: 2026-05-28 15:59:25 UTC


README

Idiomatic PHP client for Cloud Firestore.

👁 Latest Stable Version
👁 Packagist

NOTE: This repository is part of Google Cloud PHP. Any support requests, bug reports, or development contributions should be directed to that project.

A NoSQL document database built for automatic scaling, high performance, and ease of application development. While the Cloud Firestore interface has many of the same features as traditional databases, as a NoSQL database it differs from them in the way it describes relationships between data objects.

Installation

To begin, install the preferred dependency manager for PHP, Composer.

Now install this component:

$ composer require google/cloud-firestore

This component requires the gRPC extension. Please see our gRPC installation guide for more information on how to configure the extension.

Authentication

Please see our Authentication guide for more information on authenticating your client. Once authenticated, you'll be ready to start making requests.

Sample

use Google\ApiCore\ApiException;
use Google\Cloud\Firestore\V1\Client\FirestoreClient;
use Google\Cloud\Firestore\V1\Document;
use Google\Cloud\Firestore\V1\GetDocumentRequest;

// Create a client.
$firestoreClient = new FirestoreClient();

// Prepare the request message.
$request = (new GetDocumentRequest())
 ->setName($name);

// Call the API and handle any network failures.
try {
 /** @var Document $response */
 $response = $firestoreClient->getDocument($request);
 printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
 printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}

Debugging

Please see our Debugging guide for more information about the debugging tools.

Version

This component is considered GA (generally available). As such, it will not introduce backwards-incompatible changes in any minor or patch releases. We will address issues and requests with the highest priority.

Next Steps

  1. Understand the official documentation.
  2. Take a look at in-depth usage samples.