/smsw-php-sdk

PHP client SDK for The SMS Works API

Primary LanguagePHP

SwaggerClient-php

The SMS Works provides a low-cost, reliable SMS API for developers. Pay only for delivered texts, all failed messages are refunded.

This PHP package is automatically generated by the Swagger Codegen project:

  • API version: 1.3.0
  • Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen

Requirements

PHP 5.5 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/TheSMSWorks/smsw-php-sdk.git"
    }
  ],
  "require": {
    "thesmsworks/smsw-php-sdk": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/SwaggerClient-php/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$apiInstance = new Swagger\Client\Api\AuthApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$customerid = "customerid_example"; // string | Utility method. Please generate your API key by following the instructions on your account page at https://thesmsworks.co.uk/user/login

try {
    $result = $apiInstance->keySecret($customerid);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AuthApi->keySecret: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Swagger\Client\Api\AuthApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$body = new \Swagger\Client\Model\Login(); // \Swagger\Client\Model\Login | API Key & Secret

try {
    $result = $apiInstance->login($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AuthApi->login: ', $e->getMessage(), PHP_EOL;
}
?>

Documentation for API Endpoints

All URIs are relative to https://api.thesmsworks.co.uk/v1

Class Method HTTP request Description
AuthApi keySecret GET /auth/getApiKey
AuthApi login POST /auth/token
BatchMessagesApi cancelScheduledBatchJob DELETE /batches/schedule/{batchid}
BatchMessagesApi getBatchById GET /batch/{batchid}
BatchMessagesApi scheduleBatch POST /batch/schedule
BatchMessagesApi sendBatch POST /batch/send
CreditsApi credits GET /credits/balance
MessagesApi cancelScheduledJob DELETE /messages/schedule/{messageid}
MessagesApi getInboxMessages POST /messages/inbox
MessagesApi getMessageById GET /messages/{messageid}
MessagesApi getMessages POST /messages
MessagesApi scheduleMessage POST /message/schedule
MessagesApi sendMessage POST /message/send
UtilsApi getError GET /utils/errors/{errorcode}
UtilsApi test GET /utils/test

Documentation For Models

Documentation For Authorization

JWT

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Author