承接 1ff/laravel-mongodb-session 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

1ff/laravel-mongodb-session

最新稳定版本:v7.0.0

Composer 安装命令:

composer require 1ff/laravel-mongodb-session

包简介

A mongodb session driver for laravel

README 文档

README

A MongoDB session driver for Laravel

Laravel
Version
Package
Version
Install using
this command
12.x 7.x.x composer require 1ff/laravel-mongodb-session:^7.0
11.x 6.x.x composer require 1ff/laravel-mongodb-session:^6.0
10.x 5.x.x composer require 1ff/laravel-mongodb-session:^5.0
9.x 4.x.x composer require 1ff/laravel-mongodb-session:^4.0
8.x 3.x.x composer require 1ff/laravel-mongodb-session:^3.0
7.x 2.x.x composer require 1ff/laravel-mongodb-session:^2.0
5.x.x, 6.x 1.x.x composer require 1ff/laravel-mongodb-session:^1.0

Installation

Install using composer:

composer require 1ff/laravel-mongodb-session

Change the connection in config/session.php to the name of the mongo connection from your config/database.php config

'connection' =>  'mongodb',

Update your .env file and change the SESSION_DRIVER to mongodb

SESSION_DRIVER=mongodb

Advantages

  • This driver uses the MongoDB TTL indexes meaning when a session key expires it will be automatically deleted. So no need for garbage collection implementation.
  • This way, the collection's size will remain around the size you expect and won't get falsely filled with unused data.
  • The package automatically adds a migration which creates the index. If you change the name of the session.table you should rerun the ttl index creation command php artisan mongodb:session:index.

Enjoy!

Testing

This package includes a comprehensive test suite to ensure the MongoDB session handler works correctly. The tests cover:

  1. Basic session operations (read, write, destroy)
  2. Integration with Laravel's session system
  3. HTTP session functionality
  4. Laravel's testing helpers integration

Running the Tests

To run the tests, follow these steps:

  1. Make sure MongoDB is installed and running on your system
  2. Install the package dependencies with Composer:
composer install
  1. Run the tests with PHPUnit:
vendor/bin/phpunit

Continuous Integration

The package includes a GitHub Actions workflow that automatically runs tests on PHP 8.1 with Laravel 10.x against MongoDB 7. The workflow:

  1. Sets up a MongoDB service container
  2. Installs PHP with MongoDB extension
  3. Caches Composer dependencies for faster builds
  4. Runs the test suite

This ensures all tests pass before merging new changes.

Expected Test Results

When all tests are passing, you should see output similar to:

PHPUnit 10.x.x by Sebastian Bergmann and contributors.

...............                                                   15 / 15 (100%)

Time: 00:00.444, Memory: 32.00 MB

OK (15 tests, 41 assertions)

Testing Environments

The tests are compatible with:

  • PHP 8.1+
  • Laravel 10.x
  • MongoDB 4.0+

Test Coverage

  • Unit Tests: These test the MongoDbSessionHandler methods directly (open, close, read, write, destroy, gc)
  • Feature Tests: These test the integration with Laravel's session functionality
  • HTTP Tests: These test session handling in HTTP requests and session persistence
  • Laravel Helper Tests: These test integration with Laravel's testing helpers like withSession and flushSession

If you encounter any issues with the tests, please submit an issue on the GitHub repository.

1ff/laravel-mongodb-session 适用场景与选型建议

1ff/laravel-mongodb-session 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 34.29k 次下载、GitHub Stars 达 4, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 1ff/laravel-mongodb-session 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 1ff/laravel-mongodb-session 我们能提供哪些服务?
定制开发 / 二次开发

基于 1ff/laravel-mongodb-session 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 7
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 未知