2017 © Pedro Peláez
 

library touchsms

An easy-to-use PHP Class for accessing touchSMS API.

image

touchsms/touchsms

An easy-to-use PHP Class for accessing touchSMS API.

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

touchSMS

Latest Stable Version, (*1)

PHP SDK for touchSMS., (*2)

This SDK is generated automatically with JanePHP. It provides a full object-oriented interface for the endpoints, requests and responses., (*3)

You can explore the \TouchSms\ApiClient\Api namespace to see the generated classes., (*4)

Currently, only a portion of the API has been converted to openAPI, and thus this client. If you would like support for a method, please open an issue and our team will address it., (*5)

Installation

composer require touchsms/touchsms

Usage

Use the ClientFactory to create an API client., (*6)

// access token & token id can be generated at https://app.touchsms.com.au/settings/api
$client = \TouchSms\ApiClient\ClientFactory::create('ACCESS_TOKEN', 'TOKEN_ID');

$res = $client->getAccount();

Send SMS

$client = ClientFactory::create($_ENV['ACCESS_TOKEN'], $_ENV['TOKEN_ID']);

$res = $client->sendMessages(new SendMessageBody([
    'messages' => [ // Up to 1000 messages supported
        new OutboundMessage([
            'to' => '61491578888', // Test number
            'from' => 'SHARED_NUMBER',
            'body' => 'Text',
        ]),
    ],
]));

var_dump($res->getData()->getMessages()); // Successful messages, \TouchSms\ApiClient\Api\Model\OutboundMessageResponse
var_dump($res->getData()->getErrors()); // Messages with errors, \TouchSms\ApiClient\Api\Model\OutboundMessageError

Output

// array of OutboundMessageResponse objects
$message = $res->getData()->getMessages()[0];
$message->getTo();
$message->getMeta()->getParts();
$message->getMeta()->getCost();
//etc

View User Details

$res = $client->getAccount();

Output

var_dump($res->getData()); // object, \TouchSms\ApiClient\Api\Model\AccountInformation
var_dump(
    $res->getData()->getEmail(), // user
    $res->getData()->getCredits() // credit balance
);

Examples

Examples can be found in examples directory., (*7)

The Versions

29/07 2016

dev-master

9999999-dev https://github.com/touchsms/touchsms-PHP-API

An easy-to-use PHP Class for accessing touchSMS API.

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

The Development Requires

sms mobile cellphone sms gateway touchsms

29/07 2016

v1.3

1.3.0.0 https://github.com/touchsms/touchsms-PHP-API

An easy-to-use PHP Class for accessing touchSMS API.

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

The Development Requires

sms mobile cellphone sms gateway touchsms

29/07 2016

1.0.0

1.0.0.0 https://github.com/touchsms/touchsms-PHP-API

An easy-to-use PHP Class for accessing touchSMS API.

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

The Development Requires

sms mobile cellphone sms gateway touchsms