hydrakit/session 问题修复 & 功能扩展

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

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

hydrakit/session

Composer 安装命令:

composer require hydrakit/session

包简介

Session library for Hydra PHP framework

README 文档

README

A request-scoped key/value store that persists across requests for one client, backed by native $_SESSION behind two deliberately split interfaces. The data surface goes to controllers; the lifecycle surface is held only by the framework's session middleware.

The two surfaces

SessionInterface is everyday data — get/set/has/remove/all/clear, the id/regenerate controls for a privilege change, and flash/getFlash for values that live exactly one request. Falsy values ('0', 0, false, '') are real stored values; only an absent key is "missing".

SessionLifecycleInterface (start/save) is held only by StartSessionMiddleware, which opens the session on the way in and persists it on the way out. Keeping these methods off the data surface is the boundary: a controller literally cannot close the session early and lose later writes.

$session->set('cart', $items);
$session->flash('status', 'Saved.');     // readable only on the next request
$session->regenerate();                  // on a privilege change

Config

SessionConfig maps directly onto PHP's session cookie params and is built once from the environment. Defaults are safe-by-default for a first-party app: http-only, Lax same-site, session-length cookie. secure defaults to false so local http works out of the box — set SESSION_SECURE=true over https. Invalid combinations (a bad SameSite, or None without secure) fail loudly at construction rather than flowing silently into PHP.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固