andreasanta / nexmo-php-lib
There is no license information available for the latest version (dev-master) of this package.
dev-master
2016-06-23 17:38 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2025-01-15 16:23:14 UTC
README
Sending SMS via the Nexmo SMS gateway.
Quick Examples
- Sending an SMS
$sms = new NexmoMessage('account_key', 'account_secret'); $sms->sendText( '+447234567890', 'MyApp', 'Hello world!' );
- Recieving SMS
$sms = new NexmoMessage('account_key', 'account_secret'); if ($sms->inboundText()) { $sms->reply('You said: ' . $sms->text); }
- Recieving a message receipt
$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; } }
- List purchased numbers on your account
$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:
-
Either CURL is enabled for your PHP installation or the PHP option
allow_url_fopen
is set to1
(default). -
You have no firewalls blocking access to
rest.nexmo.com/sms/json
on port 443.