sakshsky / saksh-auth
A lightweight, passwordless OTP-based authentication system for Laravel applications.
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/sakshsky/saksh-auth
Requires
- php: ^8.1
- laravel/framework: ^10.0|^11.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0
This package is not auto-updated.
Last update: 2025-10-20 08:20:54 UTC
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
- Publish the migrations and configuration:
php artisan vendor:publish --tag=saksh-auth-migrations php artisan vendor:publish --tag=saksh-auth-config
- Run the migrations:
php artisan migrate
- 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
- Parameters:
-
POST /otp-auth/verify-otp- Parameters:
email,otp - Returns: Access token, token type, and user data
- Parameters:
Events
Sakshsky\SakshAuth\Events\OtpGenerated: Fired when an OTP is generatedSakshsky\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!