2017 © Pedro Peláez
 

library clockwork-sms

A PHP wrapper for Clockwork SMS API

image

mjerwin/clockwork-sms

A PHP wrapper for Clockwork SMS API

  • Saturday, March 17, 2018
  • by mjerwin
  • Repository
  • 1 Watchers
  • 1 Stars
  • 5,976 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 6 Versions
  • 4 % Grown

The README.md

clockwork-sms

A framework agnostic PHP wrapper for clockwork SMS API, (*1)

Requirements: * A Clockwork account with API Key, (*2)

Installation

Add the following to you composer.json file:, (*3)

"require": {
    "mjerwin/clockwork-sms": "~0.9",
},

Then run:, (*4)

php composer.phar update

Alternatively, run the following command:, (*5)

php composer.phar require mjerwin/clockwork-sms:~0.9

Usage

Get Account Balance

const CLOCKWORK_API_KEY = 'abcdefghijklmnopqrstuvwxyz1234567890';

$client = new \MJErwin\Clockwork\ClockworkClient(CLOCKWORK_API_KEY);

$balance = $client->getBalance();

Sending a Message

const CLOCKWORK_API_KEY = 'abcdefghijklmnopqrstuvwxyz1234567890';

$message = new \MJErwin\Clockwork\Message();
$message->setNumber('07700900123');
$message->setContent('Check out this message!');

$client = new \MJErwin\Clockwork\ClockworkClient(CLOCKWORK_API_KEY);

$response = $client->sendMessage($message);

The sendMessage() method returns an instance of \MJErwin\Clockwork\MessageResponse()., (*6)

You can use the following methods to get information from the response * getTo() * getMessageId() * getErrorCode() * getErrorDescription(), (*7)

Options

When sending a message, there are a number of optional parameters that can be given:, (*8)

// Set the name the message will be from
$message->setFromName('MJErwin');

// Set if truncating is enabled. If true, messages that are too big will be truncated
$client->setTruncateEnabled(true);

// Set the action taken if the message contains invalid chars.
$client->setInvalidCharAction(ClockworkClient::INVALID_CHAR_ACTION_RETURN_ERROR);

Class constants are provided for the values 1-3 for setInvalidCharAction() and are as follows:, (*9)

Value Constant Description
1 \MJErwin\Clockwork\ClockworkClient::INVALID_CHAR_ACTION_RETURN_ERROR Return an error
2 \MJErwin\Clockwork\ClockworkClient::INVALID_CHAR_ACTION_REMOVE_CHARS Remove the invalid characters
3 \MJErwin\Clockwork\ClockworkClient::INVALID_CHAR_ACTION_REPLACE_CHARS Replace invalid characters where possible, remove the rest

See http://www.clockworksms.com/doc/clever-stuff/xml-interface/send-sms/#param-invalidcharaction for more information., (*10)

The Versions

17/03 2018

dev-master

9999999-dev https://github.com/mjerwin/clockwork-sms

A PHP wrapper for Clockwork SMS API

  Sources   Download

MIT

The Requires

 

17/03 2018

dev-analysis-zeBMBv

dev-analysis-zeBMBv https://github.com/mjerwin/clockwork-sms

A PHP wrapper for Clockwork SMS API

  Sources   Download

MIT

The Requires

 

21/04 2016

0.9.2

0.9.2.0 https://github.com/mjerwin/clockwork-sms

A PHP wrapper for Clockwork SMS API

  Sources   Download

MIT

The Requires

 

21/04 2016

dev-develop

dev-develop https://github.com/mjerwin/clockwork-sms

A PHP wrapper for Clockwork SMS API

  Sources   Download

MIT

The Requires

 

03/12 2014

0.9.1

0.9.1.0 https://github.com/mjerwin/clockwork-sms

A PHP wrapper for Clockwork SMS API

  Sources   Download

MIT

The Requires

 

03/12 2014

0.9.0

0.9.0.0 https://github.com/mjerwin/clockwork-sms

A PHP wrapper for Clockwork SMS API

  Sources   Download

MIT

The Requires