2017 © Pedro Peláez
 

library simplesms

This library provides an easy way to interact with the Rungopher SimpleSms API

image

rungopher/simplesms

This library provides an easy way to interact with the Rungopher SimpleSms API

  • Thursday, October 12, 2017
  • by rungopher
  • Repository
  • 0 Watchers
  • 0 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Rungopher SimpleSMS PHP Library

Rungopher, (*1)

This library provides an easy way to interact with the Rungopher SimpleSms API., (*2)

Installation

Distributed via packagist. The suggested installation method is via composer:, (*3)

``` shell composer require "rungopher/simplesms:~1.0.0", (*4)



## Usage ### Sending an SMS: *Note: This example uses cURL which requires the [cURL PHP Extension](http://php.net/manual/en/book.curl.php). To use a custom requester see* ***Using a Custom Requester*** *below.* ``` php use Rungopher\SimpleSms\CurlRequester; use Rungopher\SimpleSms\SimpleSmsClient; $requester = new CurlRequester(); $client = new SimpleSmsClient($requester, "username", "password", "from"); try { $response = $client->sendSms("to", "message"); } catch(SimpleSmsErrorException $e) { log($e->getMessage()); }

Error: SimpleSmsErrorException is thrown containing the error message., (*5)

Success: $client->sendSms() returns an instance of SimpleSmsOutbound which has the following methods:, (*6)

Method Response Field
getFrom() from
getTo() to
getBody() body
getMessageSid() sid
getStatus() status

Receiving a Delivery Receipt:

``` php use Rungopher\SimpleSms\Messages\SimpleSmsDeliveryReceipt;, (*7)

$deliveryReceipt = SimpleSmsDeliveryReceipt::fromRequestBody($requestBody);, (*8)



**SimpleSmsDeliveryReceipt:** | Method | Response Field | | --------------- | -------------- | | getMessageSid() | MessageSid | | getStatus() | Status | | wasDelivered() | NA | | failed() | NA | ### Receiving an Inbound SMS: ``` php use Rungopher\SimpleSms\Messages\SimpleSmsInbound; $inboundSms = SimpleSmsInbound::fromRequestBody($requestBody);

SimpleSmsInbound:, (*9)

Method Response Field
getFrom() From
getTo() To
getBody() Body
getMessageSid() MessageSid

Using a Custom Requester

A custom requester must implement RequesterInterface:, (*10)

``` php /** returns: SimpleSmsResponse */ public function newRequest(SimpleSmsRequest $request);, (*11)


**SimpleSmsRequest:** | Method | Returns | | --------------- | --------------------- | | getBody() | The request body. | | getUrl() | The request url. | | getPort() | The request port. | | getUsername() | The request username. | | getPassword() | The request password. | **SimpleSmsResponse:** | Property | Description | | ----------------- | ----------------------------- | | statusCode | The request http status code. | | response | The request response body. | ``` php return new SimpleSmsResponse($statusCode, $response);

The Versions

12/10 2017

dev-master

9999999-dev

This library provides an easy way to interact with the Rungopher SimpleSms API

  Sources   Download

MIT

The Requires

  • php >=5.6

 

12/10 2017

1.0.5

1.0.5.0

This library provides an easy way to interact with the Rungopher SimpleSms API

  Sources   Download

MIT

The Requires

  • php >=5.6

 

12/10 2017

1.0.4

1.0.4.0

This library provides an easy way to interact with the Rungopher SimpleSms API

  Sources   Download

MIT

The Requires

  • php >=5.6

 

12/10 2017

1.0.3

1.0.3.0

This library provides an easy way to interact with the Rungopher SimpleSms API

  Sources   Download

MIT

The Requires

  • php >=5.6

 

12/10 2017

1.0.2

1.0.2.0

This library provides an easy way to interact with the Rungopher SimpleSms API

  Sources   Download

MIT

The Requires

  • php >=5.6

 

06/10 2017

1.0.1

1.0.1.0

This library provides an easy way to interact with the Rungopher SimpleSms API

  Sources   Download

MIT

The Requires

  • php >=5.6

 

06/10 2017

1.0.0

1.0.0.0

This library provides an easy way to interact with the Rungopher SimpleSms API

  Sources   Download

MIT

The Requires

  • php >=5.6