PHP code example of amirbagh75 / smsir-php

1. Go to this page and download the library: Download amirbagh75/smsir-php 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/ */

    

amirbagh75 / smsir-php example snippets




mirbagh75\SMSIR\SmsIRClient;

$apiKey = getenv('API_KEY');
$secretKey = getenv('SECRET_KEY');
$lineNumber = getenv('LINE_NUMBER');
$timeOut = 3;

$smsir = new SmsIRClient($apiKey, $secretKey, $lineNumber, $timeOut);

try {
    $res = $smsir->getSentMessages(1, 250);
    print_r($res->messages);
    print_r($res->countOfAll);
} catch (Throwable $e) {
    error_log($e->getMessage(), 0);
}



namespace App\Http\Controllers;

use Illuminate\Http\Request;

class Example extends Controller
{
    /**
     * Handle the incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function __invoke(Request $request)
    {
        // do something ...
        try {
            $res = SMSIR::getSentMessages('1399/06/01', '1399/10/01', 1, 250);
            dd($res);
        } catch (\GuzzleHttp\Exception\GuzzleException $e) {
            Log::error($e->getMessage());
        }
        // do something ...
    }
}

smsCredit(): CreditResponse

getSMSLines(): SMSLinesResponse

send(array $messages, array $mobileNumbers, $sendDateTime = null): SendResponse

sendVerificationCode(string $code, string $mobileNumber): VerificationCodeResponse

ultraFastSend(array $parameters, string $templateId, string $mobileNumber): VerificationCodeResponse

getSentMessages($fromDate, $toDate, $pageNumber = 1, $perPage = 100): SentMessagesResponse

getReceivedMessages($fromDate, $toDate, $pageNumber = 1, $perPage = 100): ReceivedMessagesResponse

composer