PHPackages                             gajus/nexmore - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. gajus/nexmore

ActiveLibrary[API Development](/categories/api)

gajus/nexmore
=============

Nexmore is Nexmo RESTful API wrapper.

0.1.0(12y ago)62871[2 PRs](https://github.com/gajus/nexmore/pulls)BSD-3-ClausePHPPHP &gt;=5.4

Since Apr 16Pushed 9y ago1 watchersCompare

[ Source](https://github.com/gajus/nexmore)[ Packagist](https://packagist.org/packages/gajus/nexmore)[ Docs](https://github.com/gajus/nexmore)[ RSS](/packages/gajus-nexmore/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (2)Used By (0)

Nexmore
=======

[](#nexmore)

[![Build Status](https://camo.githubusercontent.com/3e41d757c1673c1b0149206086db8a1e84fcf6bf0e588d64308d432b0071135d/68747470733a2f2f7472617669732d63692e6f72672f67616a75732f6e65786d6f72652e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/gajus/nexmore)[![Coverage Status](https://camo.githubusercontent.com/7c38c149e9f2e9d1d2f10ea84c76c97d8d0a0e4d9109f39bbf6c54e63c7c713b/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f67616a75732f6e65786d6f72652f62616467652e706e67)](https://coveralls.io/r/gajus/nexmore)

Nexmo offers high volume SMS and Voice APIs via REST and SMPP. Nexmore is [Nexmo RESTful API](https://docs.nexmo.com/) wrapper.

Documentation
-------------

[](#documentation)

Set Nexmo API credentials:

```
/**
 * @param string $key Nexmo account API key.
 * @param string $secret Nexmo account secret key for signing the API requests.
 * @param string $api_url
 */
$messenger = new \Gajus\Nexmore\Messenger($key, $secret);
```

### Send SMS message

[](#send-sms-message)

```
/**
 * A long SMS is split into chunks of 153 chars (in Unicode content messages 67).
 *
 * @see https://help.nexmo.com/entries/24578133-How-multipart-SMS-is-constructed-
 * @see https://docs.nexmo.com/index.php/sms-api/send-message
 * @param string $from
 * @param string $to
 * @param string $text
 * @param array $parameters
 */
$messenger->sms(string $from, string $to, string $text[, array $parameters]);
```

`sms` method will throw an `InvalidArgumentException` if either of the parameters is unknonw, missing or do not conform to the format requirements.

If at least one message is not delivered `\gajus\nexmore\Error_Exception` exception will be thrown.

```
try {
    $messenger->sms('Gajus', '447776413499', 'test');
} catch (\Gajus\Nexmore\Exception\InvalidArgumentException $e) {
    // [..]
} catch (\Gajus\Nexmore\Exception\ErrorException $e) {
    // [..]
} catch (\Gajus\Nexmore\Exception\NexmoreException $e) {
    // [..]
} catch (\Exception $e) {
    // [..]
}
```

### TTS (Text to Speech)

[](#tts-text-to-speech)

Identical to the `sms` method, except that TTS service does not accept the sender ID (from parameter).

```
/**
 * @see https://docs.nexmo.com/index.php/voice-api/text-to-speech
 * @param string $to
 * @param string $text
 * @param array $parameters
 */
$messenger->tts(string $to, string $text[, array $parameters]);
```

### Inbound Events

[](#inbound-events)

Nexmo issues two types of callbacks:

- [Delivery Receipt](https://docs.nexmo.com/index.php/sms-api/handle-delivery-receipt)
- [Inbound Message](https://docs.nexmo.com/index.php/sms-api/handle-inbound-message)

Read the relavent sections of the documentation to learn how to setup the callback URL.

To catch either of these events, use `\gajus\nexmore\Listener` class.

```
/**
 * Listens to Nexmo Delivery Receipt. All knonw receipt $_GET parameters are mapped to
 * a $receipt property. Parameter names are canonicalized.
 *
 * @param string $key
 * @param string $secret
 * @param boolean $debug Debug allows indbound traffic to come from outside of the safe subnet.
 */
$listener = new \Gajus\Nexmore\Listener();

$delivery_receipt = $listener->getDeliveryReceipt();
$inbound_message = $listener->getInboundMessage();

if ($delivery_receipt) {
    var_dump($delivery_receipt);
}

if ($inbound_message) {
    var_dump($inbound_message);
}
```

Beware that Nexmore normalises parametr names and converts whatever time input to UNIX timestamp. To understand the re-mapping implementation, refer to the `Listener` class source code.

#### Delivery Receipt

[](#delivery-receipt)

```
array(10) {
    ["sender_id"]=>
    string(11) "12150000025"
    ["recipient_number"]=>
    string(11) "66837000111"
    ["network_code"]=>
    string(5) "52099"
    ["message_id"]=>
    string(16) "000000FFFB0356D2"
    ["status"]=>
    string(9) "delivered"
    ["error_code"]=>
    string(1) "0"
    ["price"]=>
    string(10) "0.02000000"
    ["receipt_timestamp"]=>
    int(1344779940)
    int(1344779977)
    NULL
}
```

#### Inbound message

[](#inbound-message)

```
array(7) {
    ["type"]=>
    string(4) "text"
    ["recipient_number"]=>
    string(11) "12108054321"
    ["sender_id"]=>
    string(11) "19150000001"
    ["network_code"]=>
    NULL
    ["message_id"]=>
    string(16) "000000FFFB0356D1"
    ["message_timestamp"]=>
    int(1345408703)
    ["text"]=>
    string(26) "This is an inbound message"
}
```

To do
-----

[](#to-do)

- Either to allow direct API calls or create interface for Account features.

Alternatives
------------

[](#alternatives)

If you don't like Nexmore implementation, please [raise an issue](https://github.com/gajus/Nexmore/issues).

The following are the known alternatives:

-
-
-

If you know more alternatives, please tell me and I will include them in the above list.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4405d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b46b18abe058b038c677a9fa4aa6c39de7597196fb72a11add1f11600412a0e5?d=identicon)[gajus](/maintainers/gajus)

---

Top Contributors

[![gajus](https://avatars.githubusercontent.com/u/973543?v=4)](https://github.com/gajus "gajus (30 commits)")[![mrjgreen](https://avatars.githubusercontent.com/u/2183391?v=4)](https://github.com/mrjgreen "mrjgreen (2 commits)")

---

Tags

smsnexmo

### Embed Badge

![Health badge](/badges/gajus-nexmore/health.svg)

```
[![Health](https://phpackages.com/badges/gajus-nexmore/health.svg)](https://phpackages.com/packages/gajus-nexmore)
```

###  Alternatives

[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[aloha/twilio

Twilio API for Laravel

4733.6M5](/packages/aloha-twilio)[plivo/plivo-php

A PHP SDK to make voice calls &amp; send SMS using Plivo and to generate Plivo XML

1102.8M18](/packages/plivo-plivo-php)[plivo/php-sdk

A PHP SDK to make voice calls &amp; send SMS using Plivo and to generate Plivo XML

1101.9M4](/packages/plivo-php-sdk)[smsapi/php-client

SMSAPI API PHP Client

652.1M17](/packages/smsapi-php-client)[africastalking/africastalking

Official Africa's Talking PHP SDK

122557.6k10](/packages/africastalking-africastalking)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
