mahfuz/login-activity
Composer 安装命令:
composer require mahfuz/login-activity
包简介
This package will save login and logout activity of user
README 文档
README
This package will save successful login, failed login attempt and logout activity of user
Features:
- Logging Successful Login Event with IP and User Agent Information.
- Logging Logout Event with IP and User Agent Information.
- Logging Failed Login Events with IP and User Agent Information.
- Sending Email to User Upon Multiple Failed Login Attempts to Their Account On a Certain Time Interval to let them know about suspicious activity in their account.
Installation instructions for Laravel 5.3.*
Considering user_id as your primary column of users table follow below steps to install this package -
1. Installation
Install the package by running below command in your terminal -
composer require mahfuz/login-activity:dev-master
2. Adding Servicer Provider to Providers Array
Add below Service Provider in your providers array of config/app.php file
Mahfuz\LoginActivity\LoginActivityServiceProvider::class,
3. Running Migrations
Run php artisan migrate in your terminal. This will run a migration file required to make this project work which will create a table name login_activities in your database.
4. Adding Event Listeners
Add below event listeners to $listen array of app/Providers/EventServiceProvider.php
'Illuminate\Auth\Events\Login' => [
'Mahfuz\LoginActivity\Listeners\LogSuccessfulLogin',
],
'Illuminate\Auth\Events\Failed' => [
'Mahfuz\LoginActivity\Listeners\LogFailedLogin',
],
'Illuminate\Auth\Events\Logout' => [
'Mahfuz\LoginActivity\Listeners\LogSuccessfulLogout',
],
5. Accessing Routes and Views
To view login activities visit this URL http://localhost:8000/login-activity.
*** Please note that url('login-activity') is protected by auth middleware. So, only logged in user can able to browse this route path.
6. Publishing Views, Migrations and Config files
Go to your project root via terminal and run php artisan vendor:publish
Once done check config/login-activity.php, you can configure it to whether send email upon 'X' failed login attempts in last 'N' minutes or not.
Also check resources/views/vendor/login-activity if you want to update login activity view and failed login attempt email view.
That's all.
Sample View:
Happy Coding!
mahfuz/login-activity 适用场景与选型建议
mahfuz/login-activity 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 21.12k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2018 年 06 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mahfuz/login-activity 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mahfuz/login-activity 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 21.12k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-06-26
