1. Go to this page and download the library: Download web36/laravel-otp-service library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use web36\Otp\Sms\NetGsmOtpMessage ;
use web36\Otp\Netgsm ;
use web36\Otp\MessageType\OtpMessages\NetgsmOtpMessages;
class OtpServiceController extends Controller
{
public function sendOtp(Netgsm $netgsm)
{
$otp_code = rand(100000, 999999);
$message = (new NetGsmOtpMessage()) // utf 8 karakter kullanılabilir.
->setMessage(NetgsmOtpMessages::getLoginMessage($otp_code))
->setRecipients(['5xxxxxxxxx']);
$jobId = $netgsm->sendSms($message);
}
}