cndrsdrmn/passwords
Composer 安装命令:
composer require cndrsdrmn/passwords
包简介
Override and extend Laravel's password reset to support OTP-style 6-digit tokens with verification state.
README 文档
README
A streamlined OTP password reset for your Laravel application. This package seamlessly integrates with the Password facade, so you can add a 6-digit OTP and a crucial verification step, managed by a new markVerified method, without changing your existing code. It just works.
Installation
You can install the package via Composer:
composer require cndrsdrmn/passwords
The service provider is auto-discovered. If you have disabled auto-discovery, you'll need to manually register it in your bootstrap/providers.php:
return [ // ... Cndrsdrmn\Passwords\PasswordsServiceProvider::class, ],
After installation, run the migrations to create the necessary table:
php artisan migrate
You can optionally publish the migrations and translations if you need to customize them:
php artisan vendor:publish --tag=passwords-migrations php artisan vendor:publish --tag=passwords-lang
Configuration
This package uses the standard Laravel password configuration. You can find more details about configuring the password broker in the official Laravel documentation.
Quickstart
This package extends Laravel's default password broker by introducing a markVerified method. This adds an essential validation step before a password can be reset.
Before the user can reset their password, you must verify the OTP they provide. The package adds a new markVerified method to the broker, which you can call directly from the facade.
use Cndrsdrmn\Passwords\Contracts\OtpPasswordBroker as OtpBrokerContract; use Illuminate\Support\Facades\Password; $status = Password::markVerified([ 'email' => $request->email, 'token' => $request->input('otp'), ]); if ($status !== OtpBrokerContract::VERIFIED_TOKEN) { return back()->withErrors(['token' => __($status)]); }
For the rest of the password reset flow, you can follow the instructions in the official Laravel documentation.
License
This package is open-sourced software licensed under The MIT License (MIT). See the LICENSE file for more details.
Credits
- Built by: Candra Sudirman
- Inspired by: This package is inspired by the secure and flexible design of Laravel's core authentication and password reset systems.
- Package Template: Skeleton PHP
cndrsdrmn/passwords 适用场景与选型建议
cndrsdrmn/passwords 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 08 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「auth」 「laravel」 「otp」 「passwords」 「password-reset」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cndrsdrmn/passwords 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cndrsdrmn/passwords 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cndrsdrmn/passwords 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel Multiauth package
A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.
This package provides a flexible way to add Role-based Permissions to Laravel 6.x
Email Toolkit Plugin for CakePHP
OTP generating package
OTP generating package
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-29