sakshsky/saksh-auth 问题修复 & 功能扩展

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

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

sakshsky/saksh-auth

最新稳定版本:1.0.0

Composer 安装命令:

composer require sakshsky/saksh-auth

包简介

A lightweight, passwordless OTP-based authentication system for Laravel applications.

README 文档

README

Below is the full content of the README.md file for the sakshsky/saksh-auth Laravel package, as requested, provided directly in the chat.

# Saksh Auth - OTP-based Laravel Authentication

A Laravel package for passwordless authentication using one-time passwords (OTPs) sent via email.

## Installation

1. Install the package via Composer:
```bash
composer require sakshsky/saksh-auth
  1. Publish the migrations and configuration:
php artisan vendor:publish --tag=saksh-auth-migrations
php artisan vendor:publish --tag=saksh-auth-config
  1. Run the migrations:
php artisan migrate
  1. Ensure Laravel Sanctum is installed and configured:
php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"
php artisan migrate

Configuration

The package configuration is located at config/saksh-auth.php. You can customize:

  • OTP expiry time
  • Email subject
  • Email template

You can also set these values in your .env file:

SAKSH_AUTH_OTP_EXPIRY=10
SAKSH_AUTH_EMAIL_SUBJECT="Your OTP Code"
SAKSH_AUTH_EMAIL_TEMPLATE="Your OTP is: {otp}\n\nThis code will expire at {expires_at}"

API Endpoints

  • POST /otp-auth/request-otp

    • Parameters: email, name (optional)
    • Returns: Success message and OTP expiration time
  • POST /otp-auth/verify-otp

    • Parameters: email, otp
    • Returns: Access token, token type, and user data

Events

  • Sakshsky\SakshAuth\Events\OtpGenerated: Fired when an OTP is generated
  • Sakshsky\SakshAuth\Events\OtpVerified: Fired when an OTP is verified

Requirements

  • PHP >= 8.0
  • Laravel >= 10.0
  • Laravel Sanctum

License

MIT License


This `README.md` provides clear instructions for installation, configuration, and usage, along with details about API endpoints, events, requirements, and licensing. If you need modifications (e.g., adding a Packagist badge, contributing guidelines, or a changelog), let me know!

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-18