firevel / firestore
Firestore包装器,用于在Google App Engine内运行的Laravel应用程序。
1.0.5
2023-08-15 14:13 UTC
Requires
- php: ^7.1|^8.0
- google/cloud-firestore: ^1.14.1
- google/protobuf: ^v3.13.0
- grpc/grpc: ^1.30.0
- illuminate/support: ^5.8||^6.0||^7.0||^8.0||^9.0||^10.0
README
Cloud Firestore 库包装器,兼容Google App Engine标准环境,用于Laravel和Firevel。
安装
- 如果您没有设置Firestore项目,请检查Cloud Firestore快速入门
- 安装包
composer require firevel/firestore
- 在您的项目目录中(存储
app.yaml
的地方)创建php.ini文件,内容如下
; enable the gRPC extension
extension=grpc.so
; Ref.: https://github.com/colopl/laravel-spanner/issues/12
grpc.enable_fork_support = 1
如果您在Google App Engine外部使用库,请检查gRPC安装指南。
用法
要访问FirestoreClient,只需使用Firestore
外观即可,例如
$data = [ 'name' => 'Los Angeles', 'state' => 'CA', 'country' => 'USA' ]; Firestore::collection('cities')->document('LA')->set($data);
身份验证
在Google App Engine内部,Firestore应该在无需身份验证的情况下工作。对于App Engine外部使用,请查看身份验证指南。