phpgt/session
最新稳定版本:v1.2.5
Composer 安装命令:
composer require phpgt/session
包简介
Encapsulated user sessions.
README 文档
README
This library is a simple object oriented alternative to the $_SESSION superglobal allowing application code to be passed encapsulated SessionStore objects, so areas of code can have access to their own Session area without having full read-write access to all session variables.
Sessions are addressed using dot notation, allowing for handling categories of session data. This is particularly useful when dealing with user authentication, for example.
Example usage: Welcome a user by their first name or log out the user
if($session->contains("auth")) { // Remove the *whole* auth section of the session on logout. if($action === "logout") { $session->delete("auth"); } else { // Output a variable within the auth namespace: $message = "Welcome back, " . $session->getString("auth.user.name"); } } else { // Pass the "auth" store to a class, so it // can't read/write to other session variables: AuthenticationSystem::beginLogin($session->getStore("auth")); }
Proudly sponsored by
统计信息
- 总下载量: 6.26k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-03-06