2017 © Pedro Peláez
 

library nexmo-php-lib

image

crboy/nexmo-php-lib

  • Wednesday, April 2, 2014
  • by CrBoy
  • Repository
  • 1 Watchers
  • 1 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 110 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Sending SMS via the Nexmo SMS gateway.

Installation

[user@project_path]$ composer require crboy/nexmo-php-lib

Quick Examples

  1. Sending an SMS, (*1)

    $sms = new NexmoMessage('account_key', 'account_secret');
    $sms->sendText('+886900000000', 'MyApp', 'Hello world!');
    
  2. Recieving SMS, (*2)

    $sms = new NexmoMessage('account_key', 'account_secret');
    if ($sms->inboundText()) {
        $sms->reply('You said: ' . $sms->text);
    }
    
  3. Recieving a message receipt, (*3)

    $receipt = new NexmoReceipt();
    if ($receipt->exists()) {
        switch ($receipt->status) {
            case $receipt::STATUS_DELIVERED:
                // The message was delivered to the handset!
                break;
            case $receipt::STATUS_FAILED:
            case $receipt::STATUS_EXPIRED:
                // The message failed to be delivered
                break;
        }
    }
    
  4. List purchased numbers on your account, (*4)

    $account = new NexmoAccount('account_key', 'account_secret');
    $numbers = $account->numbersList();
    

Most Frequent Issues

Sending a message returns false.

This is usually due to your webserver unable to send a request to Nexmo. Make sure the following are met:, (*5)

  1. Either CURL is enabled for your PHP installation or the PHP option 'allow_url_fopen' is set to 1 (default).
  2. You have no firewalls blocking access to rest.nexmo.com/sms/json on port 443.

Your message appears to have been sent but you do not recieve it.

Run the example.php file included. This will show any errors that are returned from Nexmo., (*6)

The Versions

02/04 2014

dev-master

9999999-dev

  Sources   Download

The Requires

  • php >=5.3.0