firevel/firestore-session-driver 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

firevel/firestore-session-driver

最新稳定版本:1.0.3

Composer 安装命令:

composer require firevel/firestore-session-driver

包简介

Firestore session driver for Laravel app running inside Google App Engine.

README 文档

README

A Firestore-backed session driver for Laravel, designed to run smoothly on Google App Engine (Standard environment).

Installation

composer require firevel/firestore-session-driver

Configuration

1) Set the session driver

App Engine (app.yaml):

env_variables: SESSION_DRIVER: firestore # Optional: tune GC batch size (see "Garbage collection & scale") # SESSION_GC_BATCH_SIZE: 500

Local development (.env):

SESSION_DRIVER=firestore # SESSION_GC_BATCH_SIZE=500

Firestore credentials on App Engine Standard are picked up via Application Default Credentials. For local development, set GOOGLE_APPLICATION_CREDENTIALS if needed.

2) (Optional) Session lifetime

Configure the session lifetime as usual in config/session.php or via .env:

SESSION_LIFETIME=120

Garbage collection & scale

Firestore session cleanup happens via Laravel’s session lottery. On very high-traffic apps this can be a bottleneck. You can tune or offload it:

  • Adjust the lottery in config/session.php (note the correct path/key):
    'lottery' => [2, 100], // e.g., 2% chance per request
  • Batch size: control how many expired sessions are removed per GC pass:
    SESSION_GC_BATCH_SIZE=500
  • Heavy load / HA setups: consider moving GC out of request flow. Run cleanup on a schedule (cron/Scheduler) and set a very low lottery, or temporarily switch to the cookie driver if GC becomes a hotspot.

In extreme cases, run garbage collection from a scheduled job/cron and reduce the in-request lottery to near zero.

Limitations

统计信息

  • 总下载量: 19.66k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04