PHP code example of g4 / sms-gateway

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

    

g4 / sms-gateway example snippets




// Twilio
$account_sid = '[AccountSid]';
$auth_token  = '[AuthToken]';
$driver      = new \G4\SmsGateway\Adapter\Twilio($account_sid, $auth_token);
$smsGateway  = new \G4\SmsGateway\SmsGateway($driver);

// \G4\SmsGateway\Message
$message = $smsGateway
    ->from('+00000000000')
    ->to('+00000000000')
    ->send('Hello world!');




// Twilio
$account_sid = 'xxx';
$auth_token = 'xxx';

$driver = new \G4\SmsGateway\Adapter\Twilio($account_sid, $auth_token);
$smsGateway = new \G4\SmsGateway\SmsGateway($driver);

// \G4\SmsGateway\Message
$message = $smsGateway->view('SMxxxxxxxxxxxxx');