2017 © Pedro Peláez
 

library semaphore-client

A wrapper for accessing the Semaphore SMS API

image

kickstartph/semaphore-client

A wrapper for accessing the Semaphore SMS API

  • Friday, December 2, 2016
  • by aalabiso
  • Repository
  • 4 Watchers
  • 0 Stars
  • 319 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 3 Open issues
  • 6 Versions
  • 18 % Grown

The README.md

Semaphore Client

Semaphore Client is a PHP wrapper for the Semaphore SMS API, (*1)

Table of Contents

Installation

composer require kickstartph/semaphore-client

Basic Usage

Sending Messages

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

    use Semaphore\SemaphoreClient;
    $client = new SemaphoreClient( '{YOUR_API_KEY}', '{OPTIONAL_SENDER_NAME}' ); //Sender Name defaults to SEMAPHORE
    echo $client->send( '09991234567', 'Your message' );

The sender ID can be overridden through the client send command as well:, (*2)

    echo $client->send( '09991234567', 'Your message', '{NEW_SENDER_ID}' );

Bulk messages (to up to 1000 numbers ) can also be sent through the same API call by providing a comma delimited set of numbers:, (*3)

    echo $client->send( '09991234567,09997654321,', 'Your message' );

The response will contain a record for each message sent:, (*4)

[
  {
    "message_id": 1234567,
    "user_id": 99556,
    "user": "user@your.org",
    "account_id": 90290,
    "account": "Your Account Name",
    "recipient": "09991234567",
    "message": "The message you sent",
    "sender_name": "SEMAPHORE",
    "network": "Globe",
    "status": "Queued",
    "type": "Single",
    "source": "Api",
    "created_at": "2016-01-01 00:01:01",
    "updated_at": "2016-01-01 00:01:01"
  }
]

Retrieving Messages

You can retrieve up to 100 sent messages at a time, with support for pagination by passing the optional $page variable:, (*5)

    //Will return the results for page 2 of sent messages
    echo $client->messages( [ 'limit'=> 100 , 'page' => 2 ] ); 

Messages by date range:

    //Use any date format str_to_time() supports
    echo $client->messages( 'startDate' => '2016-10-01, '2016-10-31' );  

Messages by telco network:

    //Returns all messages sent to recipients on the Globe network
    echo $client->messages( ['globe'] ); 

Supported Filters for retrieving messages

   $options = [
        'limit' => 100,
        'page' => 1,
        'sendername' => 'SEMAPHORE',
        'startDate' => '2016-01-01',
        'endDate' => '2016-02-01',
        'network' => 'globe',
        'status' => 'success'
   ];

Other functions

Below are other calls you can make:, (*6)

Account Information

    echo $client->account();

```json { "account_id": 12345, "account_name": "Your Organization", "status": "Active", "credit_balance": 5000 }, (*7)

####Users
```php
    echo $account->users();

```json [ { "user_id": 12345, "email": "owner@your.org", "role": "Owner" }, { "user_id": 54321, "email": "someguy@your.org", "role": "User" } ], (*8)


####Sender Names ```php echo $account->sendernames();

```json [ { "name":"Semaphore", "status":"Active", "created":"2016-01-01 00:00:01" }, { "name":"Kickstart", "status":"Active", "created":"2016-01-01 00:00:01"" } ], (*9)

####Transactions
```php
    echo $account->transactions();

The Versions

02/12 2016

dev-master

9999999-dev http://semaphore.co/

A wrapper for accessing the Semaphore SMS API

  Sources   Download

MIT

The Requires

 

by Alex Alabiso

api rest sms client web service semaphore

15/07 2015

0.5

0.5.0.0 http://semaphore.co/

A wrapper for accessing the Semaphore SMS API

  Sources   Download

MIT

The Requires

 

by Alex Alabiso

api rest sms client web service semaphore

15/07 2015

0.3

0.3.0.0 http://semaphore.co/

A wrapper for accessing the Semaphore SMS API

  Sources   Download

MIT

The Requires

 

by Alex Alabiso

api rest sms client web service semaphore

15/07 2015

0.2

0.2.0.0 http://semaphore.co/

A wrapper for accessing the Semaphore SMS API

  Sources   Download

MIT

The Requires

 

by Alex Alabiso

api rest sms client web service semaphore

15/07 2015

0.1

0.1.0.0 http://semaphore.co/

A wrapper for accessing the Semaphore SMS API

  Sources   Download

MIT

The Requires

 

by Alex Alabiso

api rest sms client web service semaphore

15/07 2015

0.0

0.0.0.0 http://semaphore.co/

A wrapper for accessing the Semaphore SMS API

  Sources   Download

MIT

The Requires

 

by Alex Alabiso

api rest sms client web service semaphore