Download the PHP package skywalker-labs/passwordless without Composer
On this page you can find all versions of the php package skywalker-labs/passwordless. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download skywalker-labs/passwordless
More information about skywalker-labs/passwordless
Files in skywalker-labs/passwordless
Package passwordless
Short Description Seamless Passwordless Authentication for Laravel. Integrate OTP (One-Time Password) Login and 2FA into your default authentication flow with zero-conf middleware and ready-to-use UI.
License MIT
Homepage https://github.com/skywalker-labs/passwordless
Informations about the package passwordless
Skywalker Passwordless — OTP & Magic Link Authentication
Elegant passwordless authentication for Laravel. Drop-in OTP login, 2FA enforcement, magic links, and backup codes — all built on Skywalker Toolkit with action-oriented architecture, contract-based design, and Extreme Strictness (PHPStan Level 9 + Strict Rules) compliance.
✨ Features
| Feature | Detail |
|---|---|
| OTP Login | Generate & verify time-limited one-time passwords |
| Hashed Storage | OTPs and backup codes stored with Hash::make() — never plain-text |
| Magic Login Links | Signed, temporary URLs for one-click authentication |
| Backup Codes | Hashed emergency recovery codes |
| Multi-Channel | Email, SMS (Twilio), Slack, and Log channels |
| Event-Driven | OtpGenerated, OtpVerified, OtpFailed events for full extensibility |
| Middleware Gate | otp.verified middleware with infinite-loop protection |
| Rate Limiting | Built-in per-identifier request throttling on all routes |
| Action Architecture | Each operation is a dedicated Action class (SRP) |
| Extreme Strictness | 100% compliance with PHPStan Level 9 + Strict & Deprecation rules |
| Zero-Trust Auth | Risk-based trust scoring (TrustEngine) integrated into the core flow |
| Strict Types | declare(strict_types=1) and explicit type comparisons everywhere |
📦 Installation
Requires: PHP ≥ 8.2, Laravel ≥ 11.0
🛠️ Setup
1. Add the HasOtp Trait to Your User Model
The trait provides sendOtp(): string and verifyOtp(string $token): bool methods.
2. Publish Config & Migrations
3. Configure (config/passwordless.php)
🎯 Usage
Using the Facade
Dependency Injection (Recommended)
Inject the contract for testable, SOLID-compliant code:
Magic Login Links
Backup Codes
Custom OTP Generator
Listen to Events
Middleware Gate
Add the otp.verified middleware to any route to enforce OTP verification before access:
The middleware automatically:
- Skips users without the
HasOtptrait - Allows access once
otp_verifiedis set in the session - Excludes OTP verify routes to prevent redirect loops
🏗️ Architecture
The package follows a strict Action-Oriented + Domain-Driven architecture:
Toolkit foundation:
| Our Class | Extends |
|---|---|
| All 5 Action classes | Skywalker\Support\Foundation\Action |
OtpToken |
Skywalker\Support\Foundation\ValueObject |
OtpException |
Skywalker\Support\Exceptions\PackageException |
OtpService |
Skywalker\Support\Foundation\Service |
OtpServiceProvider |
Skywalker\Support\Providers\PackageServiceProvider |
🧪 Testing & Analysis
🔒 Security & Quality
- Extreme Strictness — 100% compliance with PHPStan Level 9 + Strict & Deprecation rules
- Zero-Trust Security — Integrated
TrustEnginefor risk-based analysis - Hashed OTPs — stored with
Hash::make(), verified withHash::check() - Hashed Backup Codes — same approach as OTPs
- Signed Magic Links — protection against link tampering
- Rate Limiting — strict per-identifier request throttling
- Strict Logic — no implicit type coercion, only explicit boolean comparisons
🔒 Zero-Trust Security
This package integrates the Skywalker Trust Engine to provide risk-based authentication:
- Trust Scoring: Every authentication attempt calculates a "Trust Score" (0.0 to 1.0) based on IP, behavior, and environment.
- Adaptive 2FA: If a user has a very high trust score (e.g. > 0.8), the
otp.verifiedmiddleware can be configured to bypass the OTP check (bypass_high_trust). - Hijack Protection: If a session's trust score drops significantly mid-session, the user is automatically prompted for re-verification.
- Session Rotation: Sessions are regenerated upon successful OTP or Magic Link verification to prevent fixation attacks.
🛣️ Available Routes
| Method | URI | Name | Auth |
|---|---|---|---|
POST |
/otp/send |
otp.send |
Public |
POST |
/otp/verify |
otp.verify |
Public |
GET |
/otp/verify |
otp.verify.view |
auth |
POST |
/otp/verify-submit |
otp.verify.submit |
auth |
POST |
/otp/resend |
otp.resend |
auth |
GET |
/magic-login |
passwordless.magic-login |
Signed URL |
📄 License
The MIT License (MIT). Please see License File.