Download the PHP package mahdialikhani/otp-authenticator without Composer
On this page you can find all versions of the php package mahdialikhani/otp-authenticator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mahdialikhani/otp-authenticator
More information about mahdialikhani/otp-authenticator
Files in mahdialikhani/otp-authenticator
Package otp-authenticator
Short Description This package assists with authenticating users using OTP (One-Time Password) method.
License MIT
Informations about the package otp-authenticator
OTP Authenticator
The OTP Authenticator package provides a simple and efficient solution for ensuring the security of your users' accounts. With the OTP (One-Time Password) method, users can securely log in to their accounts without the fear of their credentials being compromised. The package is easy to install and integrates seamlessly with your Laravel application, making it a hassle-free experience for developers.
Installation
Requirements
- PHP 8.0+
- Laravel 8+
You can install the package via composer:
and add the OTPAuthenticatorServiceProvider service provider to config/app.php
and then run:
Our default support includes two text message service provider, Ghasedak and Kavenegar, with plans to expand our support to additional services. To use any of these services, simply follow the instructions provided.
Kavenegar:
To utilize the Kavenegar service, first follow the installation instructions for the Kavenegar package as outlined in the service provider's official documentation. Then, specify the SMS sender number in the config/otpauthenticator.php file.
and then:
You can edit the toSms function in the \App\Notifications\VerificationNotification class as follows:
and done!
Ghasedak:
To utilize the ghasedak service, first follow the installation instructions for the ghasedak package provided in the official service provider's documentation. If you opt to use a pre-made text message template from the Ghasedak service, indicate the name of your selected template in the config/otpauthenticator.php file.
and then:
You can edit the toSms function in the \App\Notifications\VerificationNotification class as follows:
and done!
You can use the Laravel documentation to use the vonage service or create a personalized service by following these steps:
- Create a custom class in \App\Notifications\Messages that implements the Messageable interface.
- Define the send method for sending your text message.
- Use this class in the \App\Notifications\VerificationNotification file, similar to other services.
To conveniently access the recipient and message text, extend your message class from the "SimpleMessage" class.
for example:
Also, if you don't want the verification code to be sent to the user via text message, you can apply the email settings in your .env file and make the following changes in the file \App\Notifications\VerificationNotification to send the validation code via email.
Credits
License
The MIT License (MIT). Please see License File for more information.