gabrielesbaiz/nova-two-factor
Composer 安装命令:
composer require gabrielesbaiz/nova-two-factor
包简介
Laravel nova in-dashboard 2FA feature.
README 文档
README
Laravel nova in-dashboard 2FA feature.
Original code from Visanduma/nova-two-factor
Features
- ✅ Global enable / disable
- ✅ Mandatory / Not mandatory
- ✅ Google 2FA encrypted
- ✅ BancodeQrCode / Google API
Installation
You can install the package via composer:
composer require gabrielesbaiz/nova-two-factor
You can publish and run the migrations with:
php artisan vendor:publish --tag="nova-two-factor-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="nova-two-factor-config"
This is the contents of the published config file:
return [ 'enabled' => env('NOVA_TWO_FA_ENABLE', true), 'mandatory' => env('NOVA_TWO_FA_MANDATORY', false), 'user_table' => 'users', 'user_id_column' => 'id', 'connection_name' => env('DB_CONNECTION'), /* Encrypt the google secret values saved in database */ 'encrypt_google2fa_secrets' => false, /* QR code can be generate using Google API or inbuilt 'BaconQrCode' package */ 'use_google_qr_code_api' => true, 'user_model' => App\Models\User::class, /* Change visibility of Nova Two Fa menu in right sidebar */ 'showin_sidebar' => true, 'menu_text' => 'Two FA', 'menu_icon' => 'lock-closed', /* Exclude any routes from 2fa security */ 'except_routes' => [], /* * reauthorize these urls before access, within given timeout * you are allowed to use wildcards pattern for url matching */ 'reauthorize_urls' => [ // 'nova/resources/users/new', // 'nova/resources/users/*/edit', ], /* timeout in minutes */ 'reauthorize_timeout' => 5, ];
Usage
-
Pubish config & migration
-
Use ProtectWith2FA trait in configured model
namespace App\Models; use Gabrielesbaiz\NovaTwoFactor\ProtectWith2FA; class User extends Authenticatable{ use ProtectWith2FA; }
- Add TwoFa middleware to nova config file
/* |-------------------------------------------------------------------------- | Nova Route Middleware |-------------------------------------------------------------------------- | | These middleware will be assigned to every Nova route, giving you the | chance to add your own middleware to this stack or override any of | the existing middleware. Or, you can just stick with this stack. | */ 'middleware' => [ ... \Gabrielesbaiz\NovaTwoFactor\Http\Middleware\TwoFa::class ],
- Register NovaTwoFactor tool in Nova Service Provider
<?php class NovaServiceProvider extends NovaApplicationServiceProvider{ public function tools() { return [ ... new \Gabrielesbaiz\NovaTwoFactor\NovaTwoFactor() ]; } }
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
gabrielesbaiz/nova-two-factor 适用场景与选型建议
gabrielesbaiz/nova-two-factor 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.74k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 03 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「Gabriele Sbaiz」 「nova-two-factor」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 gabrielesbaiz/nova-two-factor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 gabrielesbaiz/nova-two-factor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 gabrielesbaiz/nova-two-factor 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A lightweight helper package to handle Eloquent model duplication.
Custom Laravel Nova 4 map detail field
A lightweight heklper package to handle WhatsApp messages using api.whatsapp.com
A lightweight helper package to handle Unsplash photos
Custom Laravel Nova 4 map card.
Customer Nova field for JSON data.
统计信息
- 总下载量: 9.74k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-04