naingaunglwin-dev/session
最新稳定版本:1.0.0
Composer 安装命令:
composer require naingaunglwin-dev/session
包简介
Simple PHP Session Library
README 文档
README
Simple PHP Session Library
Contributing
- This is an open-source library, and contributions are welcome.
- If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request on the project repository.
Requirement
- PHP version 8.0 or newer is required
Installation & Setup
- You can just download the code from repo and use or download using composer.
Download Using Composer
- If you don't have composer, install composer first.
- create file
composer.jsonat your project root directory. - Add this to
composer.json
{
"require": {
"naingaunglwin-dev/session": "^1.0"
}
}
- Run the following command in your terminal from the project's root directory:
composer install
If you already have composer.json file in your project, just run this command in your terminal,
composer require naingaunglwin-dev/session
Usage
- In your php file,
<?php require_once "vendor/autoload.php"; use NAL\Session\Session; // Create new instance of Session class $session = new Session('test', (object)[ 'secure' => true, 'httpOnly' => true, 'sameSite' => 'Strict', 'timeOut' => 3600 ]); // Session set $session->set('username', 'david'); // Session get $session->get('username'); //david // Get all session data $session->getAll(); // Session set flash message $session->setFlashMessage('message', 'success'); // Session get flash message $session->getFlashMessage('message'); // Delete Session $session->destroy('key'); // Delete All Session $session->destroy_all(); // Restart the session $session->restart();
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-02-22