PHP code example of procergs / sms-service

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

    

procergs / sms-service example snippets

 php
public function registerBundles()
{
    $bundles = array(
        // ...
        new Circle\RestClientBundle\CircleRestClientBundle(),
    );
}
 php
ptionsHandler = new \Circle\RestClientBundle\Services\CurlOptionsHandler([]);
$curl = new \Circle\RestClientBundle\Services\Curl($optionsHandler);
$client = new \Circle\RestClientBundle\Services\RestClient($curl);
 php
e libphonenumber\PhoneNumber;
use PROCERGS\Sms\SmsService;
use PROCERGS\Sms\Model\SmsServiceConfiguration;

$client = /* initialize or get HTTP client from Symfony */;

$config = new SmsServiceConfiguration(
    'https://some.address/send',
    'https://some.address/receive',
    'https://some.address/status/{id}',
    'auth realm',
    'SystemID',
    'your_secret_key',
    true
);

$service = new SmsService($client, $config);

$to = new PhoneNumber();
$to->setCountryCode('55')
    ->setNationalNumber('51987654321');

try {
    $response = $service->easySend($to, "hello world!");
    var_dump($response);
} catch (\Exception $e) {
    var_dump($e->getMessage());
}