Cloud Firestore

This SDK provides a bridge to the google/cloud-firestore package. You can enable the component in the SDK by adding the package to your project dependencies:

composer require google/cloud-firestore

Note

The google/cloud-firestore package requires the gRPC PHP extension to be installed. You can find installation instructions for gRPC at github.com/grpc/grpc. The following projects aim to provide support for Firestore without the need to install the gRPC PHP extension, but have to be set up separately:

Before you start, please read about Firestore in the official documentation:

Initializing the Firestore component

With the SDK

$firestore = $factory->createFirestore();

With Dependency Injection (Symfony Bundle/Laravel/Lumen Package)

use Kreait\Firebase\Contract\Firestore;

class MyService
{
    public function __construct(Firestore $firestore)
    {
        $this->firestore = $firestore;
    }
}

With the Laravel app() helper (Laravel/Lumen Package)

$firestore = app('firebase.firestore');

Getting started

$database = $firestore->database();

$database is an instance of Google\Cloud\Firestore\FirestoreClient. Please refer to the links above for guidance on how to proceed from here.