2017 © Pedro Peláez
 

library nexmo

Library for communicating with the Nexmo SMS API.

image

headzoo/nexmo

Library for communicating with the Nexmo SMS API.

  • Thursday, January 29, 2015
  • by headzoo
  • Repository
  • 1 Watchers
  • 0 Stars
  • 773 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 11 Versions
  • 0 % Grown

The README.md

Headzoo Nexmo

Library for communicating with the Nexmo SMS API., (*1)

Build Status Latest Stable Version MIT License, (*2)

Overview

Nexmo is an inexpensive provider of voice and text (SMS) services based in the UK. This library is used to communicate with their API for the purpose of sending text messages to mobile devices., (*3)

Installing via Composer

The recommended way to install headzoo/nexmo is through Composer., (*4)

# Install Composer
curl -sS https://getcomposer.org/installer | php

Add headzoo/nexmo to your composer.json:, (*5)

"require": {
    "headzoo/nexmo": "dev-master"
}

Or run the Composer command to install the latest stable version of headzoo/nexmo:, (*6)

composer require headzoo/nexmo

After installing, you need to require Composer's autoloader:, (*7)

require 'vendor/autoload.php';

Usage

use Headzoo\Nexmo\Sms;
use Headzoo\Nexmo\Exception\Exception;


// Start by creating an instance of Sms. You must have a Nexmo API key and secret, which you can find
// on the Nexmo dashboard. https://dashboard.nexmo.com/private/dashboard
// You also provide the "from" number or name. Each text you sent with the Sms instance will be sent
// from that number.
$nexmo_api_key = "n3xm0rocks";
$nexmo_api_secret = "12ab34cd";
$from = "12015555555";
$sms = Sms::factory($nexmo_api_key, $nexmo_api_secret, $from);


// To send a text message you pass the number you are sending to, in international format, along with
// the message to send. A Response instance is returned from which you can gather the details of the
// sent message. Keep in mind Nexmo may break up your text into several messages depending on
// the size of the sent message, and the Response will contain multiple Message instances.
try {
    $to = "19295555555";
    $message = "Hello, World!";
    $response = $sms->text($to, $message);
    foreach($response as $message) {
        echo "Message ID: " . $message->getId();
        echo "Message price: " . $message->getPrice();
        echo "Remaining balance: " . $message->getBalance();
    }
} catch (Exception $e) {
    echo $e->getMessage();
}

The Versions

29/01 2015

dev-master

9999999-dev

Library for communicating with the Nexmo SMS API.

  Sources   Download

MIT

The Requires

 

The Development Requires

29/01 2015

dev-dev

dev-dev

Library for communicating with the Nexmo SMS API.

  Sources   Download

MIT

The Requires

 

The Development Requires

29/01 2015

v0.1.3.1

0.1.3.1

Library for communicating with the Nexmo SMS API.

  Sources   Download

MIT

The Requires

 

The Development Requires

29/01 2015

v0.1.3

0.1.3.0

Library for communicating with the Nexmo SMS API.

  Sources   Download

MIT

The Requires

 

The Development Requires

28/01 2015

v0.1.2.4

0.1.2.4

Library for communicating with the Nexmo SMS API.

  Sources   Download

MIT

The Requires

 

The Development Requires

28/01 2015

v0.1.2.3

0.1.2.3

Library for communicating with the Nexmo SMS API.

  Sources   Download

MIT

The Requires

 

The Development Requires

28/01 2015

v0.1.2.1

0.1.2.1

Library for communicating with the Nexmo SMS API.

  Sources   Download

MIT

The Requires

 

The Development Requires

28/01 2015

v0.1.2.2

0.1.2.2

Library for communicating with the Nexmo SMS API.

  Sources   Download

MIT

The Requires

 

The Development Requires

28/01 2015

v0.1.2

0.1.2.0

Library for communicating with the Nexmo SMS API.

  Sources   Download

MIT

The Requires

 

The Development Requires

28/01 2015

v0.1.1

0.1.1.0

Library for communicating with the Nexmo SMS API.

  Sources   Download

MIT

The Requires

 

The Development Requires

28/01 2015

v0.1

0.1.0.0

Library for communicating with the Nexmo SMS API.

  Sources   Download

MIT

The Requires

 

The Development Requires