承接 dgtlinf/passwordless 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

dgtlinf/passwordless

Composer 安装命令:

composer require dgtlinf/passwordless

包简介

Headless Laravel package for passwordless authentication via magic link or OTP code

README 文档

README

Latest Version on Packagist GitHub Tests Action Status License

A modern, headless, and framework-agnostic passwordless authentication system for Laravel.
Easily send magic links and OTP codes without managing passwords.

🚀 Features

  • 🔑 Passwordless login with OTP or magic link
  • ⚙️ Configurable OTP length and type (numeric, alpha, alphanumeric)
  • 🕒 Expiration control for tokens and magic links
  • 📬 Notification-based delivery (email-ready, customizable channel)
  • 🧩 Event-driven: PasswordlessTokenCreated, PasswordlessTokenConsumed, PasswordlessLoginSucceeded
  • 🌍 Localization-ready (translations publishable)
  • 🧪 100% test coverage with Pest + Orchestra Testbench
  • 🧱 Fully decoupled — no frontend required

⚙️ Installation

composer require dgtlinf/passwordless

Then publish the configuration and migration with the easy install command:

php artisan passwordless:install

or you can just publish things separately:

php artisan vendor:publish --tag="passwordless-config"
php artisan vendor:publish --tag="passwordless-migrations"
php artisan migrate

🧩 Configuration

File: config/passwordless.php

Key sections:

models

Define which models to use.
You can override both the User model and the Token model.

'models' => [
    'user'  => App\Models\User::class,
    'token' => Dgtlinf\Passwordless\Models\PasswordlessToken::class,
],

notification

Define which notification class is used to deliver OTPs or links, and which route name generates the magic link.

'notification' => [
    'class' => Dgtlinf\Passwordless\Notifications\PasswordlessLoginNotification::class,
    'route' => 'passwordless.magic', // used by URL::temporarySignedRoute()
],

otp

Configure OTP behavior.

'otp' => [
    'length' => 6,
    'type'   => 'numeric', // 'alpha' | 'alphanumeric' | 'numeric'
],

link

Configure token expiration for the magic link.

'link' => [
    'expire_minutes' => 30,
    'token_length'   => 64,
],

prune

Automatic cleanup for old tokens (via Laravel’s model pruning).

'prune' => [
    'enabled' => true,
    'after_days' => 7,
],

🧠 Usage

1️⃣ Add the trait to your User model

use Dgtlinf\Passwordless\Traits\HasPasswordlessLogin;

class User extends Authenticatable
{
    use Notifiable, HasPasswordlessLogin;
}

2️⃣ Trigger passwordless login

use Dgtlinf\Passwordless\Facades\Passwordless;

Passwordless::send($user); // Sends OTP + magic link

3️⃣ Verify OTP or token

Passwordless::verifyOtp($user, $otp);     // via code
Passwordless::verifyToken($user, $token); // via magic link

🧩 Events

The following events are dispatched automatically and can be listened to in your app:

Event Description
PasswordlessTokenCreated Fired when a token and OTP are generated
PasswordlessTokenConsumed Fired when a token is successfully used
PasswordlessLoginSucceeded Fired when login completes successfully

Example listener registration (EventServiceProvider):

protected $listen = [
    Dgtlinf\Passwordless\Events\PasswordlessLoginSucceeded::class => [
        App\Listeners\LogPasswordlessLogin::class,
    ],
];

🌍 Translations

Translations are stored in resources/lang/vendor/passwordless/en/passwordless.php and can be published via:

php artisan vendor:publish --tag="passwordless-translations"

🧪 Testing

Run test suite:

vendor/bin/pest

All tests run using in-memory SQLite and are automatically configured via Orchestra Testbench.

🧾 License

Released under the MIT License.
Copyright © Digital Infinity DOO Novi Sad.

Website: digitalinfinity.rs

dgtlinf/passwordless 适用场景与选型建议

dgtlinf/passwordless 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 10 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 dgtlinf/passwordless 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 20
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-08