Skip to content
Firestore SDK for PHP without gRPC
PHP
Branch: master
Clone or download
Latest commit 18c30a9 Feb 24, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci run test through composer May 24, 2018
src Add check. Fixes #12 Feb 24, 2019
tests feat: Support query options when retrieving documents. Fixes #6 Oct 21, 2018
.editorconfig Migrate PR over May 23, 2018
.gitignore put thing sin env vars May 24, 2018
LICENSE Initial commit May 23, 2018
README.md Update README.md Sep 2, 2018
composer.json fix: Update dependencies #2 Aug 8, 2018
composer.lock fix: Update dependencies #2 Aug 8, 2018
package.json try release May 24, 2018
phpunit.xml.dist put thing sin env vars May 24, 2018

README.md

Firestore SDK for PHP without gRPC

Current version Build Status

@todo

  • Get
  • Set
  • Delete
  • Add
  • Transactions (beginTransaction, commit, rollback)
  • Reference value support
  • Batch Get
  • List Documents
  • Query
  • Order
  • Limit
  • Indexes (create, delete, list, get)

Installation

The recommended way to install is with Composer.

composer require morrislaptop/firestore-php

Usage

The library aims to replicate the API signature of Google's PHP API.

Sample usage:


use Morrislaptop\Firestore\Factory;
use Kreait\Firebase\ServiceAccount;

// This assumes that you have placed the Firebase credentials in the same directory
// as this PHP file.
$serviceAccount = ServiceAccount::fromJsonFile(__DIR__ . '/google-service-account.json');

$firestore = (new Factory)
    ->withServiceAccount($serviceAccount)
    ->createFirestore();

$collection = $firestore->collection('users');
$user = $collection->document('123456');

// Save a document
$user->set(['name' => 'morrislaptop', 'role' => 'developer']);

// Get a document
$snap = $user->snapshot();
echo $snap['name']; // morrislaptop
You can’t perform that action at this time.