tigo/login-session
Composer 安装命令:
composer require tigo/login-session
包简介
login using the session feature
README 文档
README
Creating session for login in PHP
- MIT license. Feel free to use this project. Leave a star ⭐ !
- Download package:
composer require tigo/login-session
If you found this project useful, consider making a donation to support the developer.
Introduction
Somewhere in your project, you may need to use autoload
include __DIR__ ."/vendor/autoload.php";
Example
- Configuration:
In the src/config/Standard.php directory
- In the Standard class there is a method called postLogin(), it is through it that you will implement your logic.
- By default the postLogin() method has an implemented logic which receives data from an array, to perform post validation
// the function must return a boolean value. public function postLogin() { $user = isset($_POST[self::USER]) ? $_POST[self::USER] : false; $pw = isset($_POST[self::PW]) ? md5($_POST[self::PW]) : false; $table = TestMatrix::table(); foreach ($table as $key => $item) { if($user == $item->user && $pw == $item->password){ $_SESSION[self::SESSION] = $_POST[self::USER]; return true; } } return false; }
Method TestMatrix::table()
public static function table() { return [ 1=> (object) ["user"=>"admin","password"=>md5("123")], 2=> (object) ["user"=>"admin2","password"=>md5("1234")], 3=> (object) ["user"=>"admin3","password"=>md5("12345")] ]; }
Example methods
use Tigo\LoginSession\Login; // import class $login = new Login(); $login->validate();
| Method | Description |
|---|---|
| validate() | This method is responsible for validating the login. |
| auth() | On a private page where the user must be logged in, you can use this method in the page controller or on the page itself. |
| logout() | Use this method to destroy session or logout. |
| user() | Use this method to collect session information. |
Problems
If you discover any issues, please contact my email or issue tracker and post the details.
Contributors
License
MIT license. See the archive License
tigo/login-session 适用场景与选型建议
tigo/login-session 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 08 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「login」 「session」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tigo/login-session 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tigo/login-session 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tigo/login-session 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
WeChat OAuth SDK
Secure session middleware for Slim 3 framework
Debugging a problem and need to login as one of your customers? This allows you to authenticate as any of your customers.
Non-I/O blocking PHP SessionHandler implementation using Nette/Caching with DI Extension for Nette framework
A Silverstripe module to allow you to log into any of your Silverstripe sites from one place.
Magento 2 Social Login extension is designed for quick login to your Magento 2 store without procesing complex register steps
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-08-02