firevel / firestore
Firestore wrapper for Laravel app running inside Google App Engine.
Installs: 17 323
Dependents: 2
Suggesters: 0
Security: 0
Stars: 7
Watchers: 2
Forks: 4
Open Issues: 0
Requires
- php: ^8.0
- google/cloud-firestore: ^v1.41.2
- grpc/grpc: ^1.30.0
- illuminate/support: ^5.8||^6.0||^7.0||^8.0||^9.0||^10.0||^11.0||^12.0
README
A lightweight wrapper around the official Cloud Firestore PHP client for Laravel and Firevel, compatible with Google App Engine Standard.
Installation
-
Create a Firestore project
If you don’t have one yet, follow the Cloud Firestore quick start. -
Install the package
composer require firevel/firestore
-
Enable gRPC extensions
If you’re deploying to Google App Engine Standard, create aphp.ini
next to yourapp.yaml
with:extension=grpc.so extension=protobuf.so
Using the library outside of App Engine? See the gRPC installation guide and Installing the protobuf runtime library.
Tinker / PsySH note
If the pcntl
extension is enabled, set usePcntl
to false in your .psysh.php
to avoid gRPC calls hanging in Tinker:
<?php return [ 'usePcntl' => false, ];
Usage
Use the Firestore
facade to access the client:
use Firevel\Firestore\Facades\Firestore; $data = [ 'name' => 'Los Angeles', 'state' => 'CA', 'country' => 'USA', ]; Firestore::collection('cities')->document('LA')->set($data);
Authentication
On Google App Engine Standard, Firestore works without additional credentials.
For local development or other environments, follow the official
Authentication guide
(e.g., set GOOGLE_APPLICATION_CREDENTIALS
).
Resources
- Official Firestore docs: https://cloud.google.com/firestore/docs/
- In-depth PHP samples: https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/firestore