PHP code example of mimisk13 / laravel-easysms

1. Go to this page and download the library: Download mimisk13/laravel-easysms 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/ */

    

mimisk13 / laravel-easysms example snippets


use Mimisk13\LaravelEasySMS\Facades\EasySMS;

$smsResult = EasySMS::send('+1234567890', 'This is an SMS message');

if ($smsResult) {
    echo "SMS sent successfully!";
} else {
    echo "Failed to send SMS.";
}

use Mimisk13\LaravelEasySMS\Facades\EasySMS;

$viberResult = EasySMS::send('+1234567890', 'This is a Viber message', 'viber');

if ($viberResult) {
    echo "Viber message sent successfully!";
} else {
    echo "Failed to send Viber message.";
}

use Mimisk13\LaravelEasySMS\Facades\EasySMS;

$balance = EasySMS::getBalance();

if ($balance && $balance['status'] == 1) {
    echo "Current balance: " . $balance['amount'];
} else {
    echo "Failed to retrieve balance.";
}

use Mimisk13\LaravelEasySMS\Facades\EasySMS;

$mobile = EasySMS::mobile('1234567890');

dump($mobile);

// result
array [
  "status" => "1"
  "remarks" => "Success"
  "error" => "0"
  "total" => 1
  "mobile" => array [
    "msisdn" => "301234567890"
    "national" => "1234567890"
    "country" => "GREECE"
    "countryCode" => 30
    "gsmCode" => "123"
    "number" => "4567890"
    "mcc" => "202"
    "mnc" => "05"
    "cost" => 1
  ]
]
bash
php artisan vendor:publish --tag=easysms.config