PHP code example of polygontech / sms-service-client

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

    

polygontech / sms-service-client example snippets


use Polygontech\SmsService\Inputs\Feature;

enum SmsFeatures implements Feature
{
    case TEST;
    case OTP;

    public function getFeatureType(): string
    {
        switch ($this) {
            case self::TEST: return "test";
            case self::OTP: return "otp";
        }
    }
}

// or,

enum SmsFeatures : string implements Feature
{
    case TEST = "test";
    case OTP = "otp";

    public function getFeatureType(): string
    {
        return $this->value;
    }
}

use Polygontech\CommonHelpers\Mobile\BDMobile;
use Polygontech\SmsService\Facades\Sms;
use Polygontech\SmsService\Responses\SingleSmsResponse;

/** @var SingleSmsResponse $output */
$output = Sms::shoot(SmsFeatures::TEST, new BDMobile("+8801678242960"), "test sms"));

use Polygontech\CommonHelpers\Mobile\BDMobile;
use Polygontech\SmsService\Facades\Sms;
use Polygontech\SmsService\Responses\BulkSmsResponse;

/** @var BulkSmsResponse $output */
$output = Sms::shoot(SmsFeatures::TEST, [
    new BDMobile("+8801678242960"),
    new BDMobile("+8801678242961"),
], "test bulk sms"));
bash
php artisan vendor:publish --provider='Polygontech\SmsService\ServiceProvider'

# or,

php artisan vendor:publish # and select 'Polygontech\SmsService\ServiceProvider' when prompted