empuxa/laravel-pin-login 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

empuxa/laravel-pin-login

最新稳定版本:v3.0.1

Composer 安装命令:

composer require empuxa/laravel-pin-login

包简介

Say goodbye to passwords and sign in via PIN instead.

README 文档

README

This package has been renamed. The successor can be found here: https://github.com/empuxa/laravel-totp-login

Latest Version on Packagist Tests Total Downloads

Banner

Say goodbye to passwords and sign in via PIN instead! Laravel PIN Login is a convenient package that allows you to easily add a PIN login feature to your Laravel application.

Why Choose Laravel PIN Login?

You might wonder why you should opt for a PIN login instead of a magic link solution. Well, this package is designed to complement the existing login methods in your application. It provides an alternative sign-in option for users who haven't set a password yet or don't have an email address. For instance, users who signed up with only a phone number can still enjoy the benefits of secure login through a PIN.

Features

  • Simplified sign-in process using a PIN
  • Compatibility with existing login methods
  • Support for users without passwords or email addresses

How it works

Requirements

In addition to Laravel v9.52 or newer, this package relies on Alpine.js. If you're using Laravel LiveWire, you are already good to go. Otherwise, ensure to include Alpine.js in your application. Also, you need to have a notifiable user model.

Installation

Install the package via composer:

composer require empuxa/laravel-pin-login

Copy the vendor files and adjust the config file config/pin-login.php to your needs:

php artisan vendor:publish --provider="Empuxa\PinLogin\PinLoginServiceProvider"

Run the migrations:

php artisan migrate

That's it! You're ready to start using the PIN login feature in your Laravel application.

Usage

The sign-in process for this repository involves three steps:

  1. Enter the user's email address, phone number, or any other specified identifier, and request a PIN.
  2. If the entered information is valid, a PIN will be sent to the user. You may need to customize the notification channel based on the user model you are using.
  3. Enter the received PIN to log in the user.

Customizing the Views

While the initial steps are relatively straightforward, it's now necessary to customize the views. These views have been designed to be as simple as possible (some might even consider them "ugly") and can be located in the resources/views/vendor/pin-login directory.

Why are they not visually appealing? Different applications adopt various layouts and frameworks. Since you have the most knowledge about your application, you can change the views to suit your specific requirements.

Modifying the Notification

Within the copied views, you will come across a notification that's sent to the user. You may want to make adjustments to this notification to align it with your preferences and needs.

Different Notification Channels

If you plan on utilizing SMS or similar as your preferred notification channel, you have the option to create a custom notification class. The PIN and the user's IP address will be passed to the constructor of this class. Finally, replace the default notification class within the config/pin-login.php file with your custom notification.

Custom User Model Scope

To apply a scope to your user model, add the following method to your model:

public static function pinLoginScope(): Builder
{
    return self::yourGlobalScope();
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

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.

empuxa/laravel-pin-login 适用场景与选型建议

empuxa/laravel-pin-login 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.59k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2023 年 06 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「Passwordless」 「empuxa」 「pin-login」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 empuxa/laravel-pin-login 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 empuxa/laravel-pin-login 我们能提供哪些服务?
定制开发 / 二次开发

基于 empuxa/laravel-pin-login 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 5.59k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 12
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-26