firevel/firestore

Firestore包装器,用于在Google App Engine内运行的Laravel应用程序。

1.0.5 2023-08-15 14:13 UTC

This package is auto-updated.

Last update: 2024-09-16 00:04:28 UTC


README

Cloud Firestore 库包装器,兼容Google App Engine标准环境,用于LaravelFirevel

安装

  1. 如果您没有设置Firestore项目,请检查Cloud Firestore快速入门
  2. 安装包 composer require firevel/firestore
  3. 在您的项目目录中(存储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外部使用,请查看身份验证指南

更多信息

  1. Firestore官方文档.
  2. 深入使用示例.