PHP code example of masoudi / sms

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

    

masoudi / sms example snippets


// sms.php
[
    "default" => "kavenegar",
]

// sms.php
[
    "kavenegar" => [
        "token" => "xxxxxx"
    ]
]

use Masoudi\SMS\Facade\SMS;
use Masoudi\SMS\Drivers\Kavenegar;

 SMS::driver(function (Kavenegar $kavenegar) {
    $kavenegar->lookup('09123456789', 'verify', ['%token' => '1234']);
 });


use Masoudi\SMS\Facade\SMS;
use Masoudi\SMS\Drivers\Kavenegar;

 SMS::driver()->lookup('09123456789', 'verify', ['%token' => '1234']);

use Masoudi\SMS\Contracts\BaseSmsDriver;

class MeliPayamek extends BaseSmsDriver {

    // متد های درایور خود را اضافه کنید
    public function send(string $from, string $to, string $text): void {
        // ارسال پیام...
    }

}


// AppServiceProvider.php

use Masoudi\SMS\Facade\SMS;

public function boot() {

    SMS::register('melipayamak', MeliPayamek::class);
    
}

// sms.php
...
    "melipayamak" => [
        "api_url" => "https://xxxxx"
    ],
...
shell
php artisan vendor:publish --tag=masoudi-sms-config