2017 © Pedro Peláez
 

library sms-service

PROCERGS SMS Service

image

procergs/sms-service

PROCERGS SMS Service

  • Friday, May 25, 2018
  • by guilhermednt
  • Repository
  • 4 Watchers
  • 0 Stars
  • 733 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 8 Versions
  • 12 % Grown

The README.md

PROCERGS SMS Service

This is for internal use only. If you do not work at PROCERGS or any of its software, this is most certainly not useful to you., (*1)

Installation

Important: Currently this lib depends on RestClientBundle so you'll have to load this bundle onto Symfony. We will change to Guzzle 6 HTTP client as soon as PROCERGS updates it's PHP servers., (*2)

Run the following command to add the composer dependency and install it:, (*3)

composer require procergs/sms-service

If you are using Symfony, enable RestClientBundle on your AppKernel.php:, (*4)

``` php public function registerBundles() { $bundles = array( // ... new Circle\RestClientBundle\CircleRestClientBundle(), ); }, (*5)


Or just initialize it: ``` php require_once 'vendor/autoload.php'; $optionsHandler = new \Circle\RestClientBundle\Services\CurlOptionsHandler([]); $curl = new \Circle\RestClientBundle\Services\Curl($optionsHandler); $client = new \Circle\RestClientBundle\Services\RestClient($curl);

Usage

You can send a message with the following code:, (*6)

``` php require_once 'vendor/autoload.php';, (*7)

use libphonenumber\PhoneNumber; use PROCERGS\Sms\SmsService; use PROCERGS\Sms\Model\SmsServiceConfiguration;, (*8)

$client = /* initialize or get HTTP client from Symfony */;, (*9)

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

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

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

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

The Versions

17/05 2017
04/04 2017
04/04 2017
04/04 2017
03/04 2017