plexcellmedia / firestore
Firestore封装库,适用于运行在Google App Engine中的Laravel应用程序。
1.0.3
2020-08-26 02:55 UTC
Requires
- php: >=7.1
- google/cloud-firestore: ^1.14.1
- google/protobuf: ^v3.13.0
- grpc/grpc: ^1.30.0
- illuminate/support: ^5.8||^6.0||^7.0
This package is not auto-updated.
Last update: 2024-09-21 19:47:35 UTC
README
Cloud Firestore库封装,用于与Laravel和Firevel兼容,支持Google App Engine标准环境(PHP 7.3)。
安装
- 如果您尚未设置firestore项目,请查看Cloud Firestore快速入门
- 安装包:
composer require firevel/firestore
- 在项目目录中创建php.ini文件(其中包含
app.yaml
的存储位置)并添加以下内容:
; 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之外的使用,请查看身份验证指南。