PHP code example of web36 / laravel-otp-service

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/ */

    

web36 / laravel-otp-service example snippets


NETGSM_USERCODE=""
NETGSM_SECRET=""
NETGSM_LANGUAGE="tr"
NETGSM_HEADER= ""
NETGSM_BRANDCODE= null
NETGSM_SMS_SENDING_METHOD="xml"
NETGSM_BASE_URI=""
NETGSM_TIMEOUT=
NETGSM_OPERATOR_CODE=""



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);


    }
}


php artisan vendor:publish --provider="web36\Otp\ServiceProvider" --tag="otp-config"