Download the PHP package tech-ed/simpl-otp without Composer
On this page you can find all versions of the php package tech-ed/simpl-otp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tech-ed/simpl-otp
More information about tech-ed/simpl-otp
Files in tech-ed/simpl-otp
Package simpl-otp
Short Description A simple and lightweight Laravel package for generating and verifying one-time passwords (OTPs), enhancing authentication security in your Laravel applications.
License MIT
Informations about the package simpl-otp
SimplOtp
SimplOtp is a Laravel package that simplifies the generation and validation of one-time passwords (OTPs) in your Laravel applications.
This package is inspired by ichtrojan/laravel-otp but modified to be a little bit more flexible.
Installation
You can install the SimplOtp package via Composer:
After installing the package, run the migration command to create the necessary database table:
The package will automatically register its service provider and facade.
Configuration
To customize SimplOtp's behavior, you can publish its configuration file using the following artisan command:
This command will copy the configuration file config/simplotp.php
to your application's config
directory, where you can modify it according to your needs.
Configuration Options
- Success Messages: Customize success messages for OTP generation and validation.
- Error Messages: Customize error messages for various failure scenarios.
- OTP Settings: Configure OTP length, type (numeric or alphanumeric), and validity period in minutes.
Usage
Generating an OTP
You can generate an OTP using the SimplOtp::generate()
method. It requires an identifier associated with the OTP.
Validating an OTP
To validate an OTP, use the SimplOtp::validate()
method, passing the identifier and the OTP token.
Customization
You can customize success and error messages by editing the config/simplotp.php
configuration file. Additionally, you can adjust OTP settings to suit your application's requirements.
Generate Email Notification
To create a basic email template inside the Notifications folder, run the following artisan command:
This command allows you to customize the email notification template according to your specific requirements.
Email Notification Example
To send an OTP via email, you can use Laravel's built-in notification system along with the provided EmailOtpVerification
notification class.
This example generates an OTP for the authenticated user's email address and sends it via email using the EmailOtpVerification notification class.
Support the Developer
If SimplOtp has been helpful to you and you'd like to support its development, consider buying the developer a cup of coffee! ☕
Your support is greatly appreciated and helps in maintaining and improving SimplOtp for the Laravel community.
License
The SimplOtp package is open-sourced software licensed under the MIT license.