PHP code example of usmsgh / usmsgh-api-sdk

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

    

usmsgh / usmsgh-api-sdk example snippets



use Urhitech\Usms;


use use Urhitech\Usms;;

// config/services.php
...
'all_my_sms' => [
    'endpoint' => env('USMSGH_ENDPOINT', 'https://webapp.usmsgh.com/api/sms/send'),
    'api_token' => env('USMSGH_API_TOKEN'),
    'sender_id' => env('USMSGH_SENDER'),
    'universal_to' => env('USMSGH_UNIVERSAL_TO'),
],
...

public function routeNotificationForUsmsgh(Notification $notification)
{
    return $this->phone_number;
}

$client = new Urhitech\Usms;

$api_key = "Enter Your API Key here";

$url = "https://webapp.usmsgh.com/api/sms/send";

$recipients = "233500000000,233540000000";
$message = "Hello world";
$senderid = "Enter your approved sender ID here";

$response = $client->send_sms($url, $api_key, $senderid, $recipients, $message);

$api_key = "Enter Your API TOKEN here";

$url = "https://webapp.usmsgh.com/api/balance";

$get_credit_balance = $client->check_balance($url, $api_key);

$api_key = "Enter Your API Key here";

$url = "https://webapp.usmsgh.com/api/me";

$get_profile = $client->profile($url, $api_key);
 php
use Urhitech\Umsmgh\UsmsChannel;
use Urhitech\Umsmgh\UsmsMessage;
use Illuminate\Notifications\Notification;

class ProjectCreated extends Notification
{
    public function via($notifiable)
    {
        return [UsmsChannel::class]; // or 'usmsgh'
    }

    public function toUsms($notifiable)
    {
        return new UsmsMessage('Content');
    }
}