PHPackages                             connect-corp/nexmo-client - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. connect-corp/nexmo-client

ActiveLibrary[HTTP &amp; Networking](/categories/http)

connect-corp/nexmo-client
=========================

Unofficial Nexmo Rest Client

0.1.0(11y ago)16223.6k↓19.4%13[1 issues](https://github.com/ConnectCorp/nexmo-client/issues)[2 PRs](https://github.com/ConnectCorp/nexmo-client/pulls)MITPHPPHP &gt;=5.4.0

Since Feb 26Pushed 9y ago15 watchersCompare

[ Source](https://github.com/ConnectCorp/nexmo-client)[ Packagist](https://packagist.org/packages/connect-corp/nexmo-client)[ Docs](https://github.com/ConnectCorp/nexmo-client)[ RSS](/packages/connect-corp-nexmo-client/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (2)Versions (8)Used By (0)

nexmo-client [![Build Status](https://camo.githubusercontent.com/a9ac483261f49ba1c685be3c59b85ba90b61aa7d321cc49d0dfa9064e1d7f153/68747470733a2f2f7472617669732d63692e6f72672f436f6e6e656374436f72702f6e65786d6f2d636c69656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ConnectCorp/nexmo-client) [![Code Climate](https://camo.githubusercontent.com/2b17d41d68a6a79479814bd22de0252c164d1e9985524517d4f74596b12e19dc/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f436f6e6e656374436f72702f6e65786d6f2d636c69656e742f6261646765732f6770612e737667)](https://codeclimate.com/github/ConnectCorp/nexmo-client)
=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#nexmo-client--)

Unofficial [Nexmo](https://www.nexmo.com/) Rest Client

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

[](#documentation)

[Nexmo API Documentation](https://docs.nexmo.com/)

How to Install
--------------

[](#how-to-install)

```
$ composer require connect-corp/nexmo-client
```

Usage examples
--------------

[](#usage-examples)

### Setting up the client object

[](#setting-up-the-client-object)

```
    $apiKey = 'api_key_from_nexmo_account';
    $apiSecret = 'api_secret_from_nexmo_account';
    $nexmo = new \Nexmo\Client($apiKey, $apiSecret);
```

### Sending a message

[](#sending-a-message)

```
	$from = '1234567890';
	$to = '15551232020';
	$text = 'hello world';
    try {
        $response = $nexmo->message->invoke($from, $to, 'text', $text);
    } catch (Exception $e) {
        die($e->getMessage());
    }
    foreach ($response['messages'] as $i => $m) {
        switch ($m['status']) {
        case '0':
            echo 'Message sent successfully:';
			print_r($m);
            break;

        default:
            echo 'Message sending failed:'
			print_r($m);
            break;
        }
    }
```

### Getting account balance

[](#getting-account-balance)

```
	try {
	    $response = $nexmo->account->balance();
	} catch (Exception $e) {
        die($e->getMessage());
	}
	echo "Account balance is $response";
```

### Getting pricing by destination country

[](#getting-pricing-by-destination-country)

```
	$country = 'US';
	try {
        $response = $nexmo->account->pricing->country($country);
	} catch (Exception $e) {
        die($e->getMessage());
	}
	echo 'Price is ' . $response->price();
```

### Getting pricing by recipient number

[](#getting-pricing-by-recipient-number)

```
	$number = '15551232020';
	try {
		// SMS pricing.
        $response = $nexmo->account->pricing->sms($number);
		// Voice pricing.
        $response = $nexmo->account->pricing->voice($number);
	} catch (Exception $e) {
        die($e->getMessage());
	}
	echo 'Price is ' . $response->price();
```

### Search for long virtual numbers by country

[](#search-for-long-virtual-numbers-by-country)

```
	$country = 'US';
	try {
        $response = $nexmo->number->search($country);
	} catch (Exception $e) {
        die($e->getMessage());
	}
    $all = $response->all();
	if (isset($all['numbers'])) {
		foreach	($all['numbers'] as $n) {
            printf("%d  \$%01.2f  %-10s  %-15s\n", $n['msisdn'], $n['cost'], $n['type'], join(',', $n['features']));
		}
	}
```

### Buy a long virtual number

[](#buy-a-long-virtual-number)

```
	$country = 'US';
	$msisdn = '1234567890'; // Number found using $nexmo->number->search()
	try {
        $response = $nexmo->number->buy($country, $msisdn);
	} catch (Exception $e) {
        die($e->getMessage());
	}
	if (200 == $response['error-code']) {
		echo 'Number purchase success';
	}
```

### List long virtual numbers in your account

[](#list-long-virtual-numbers-in-your-account)

```
	$country = 'US';
	try {
        $response = $nexmo->account->numbers();
	} catch (Exception $e) {
        die($e->getMessage());
	}
    $all = $response->all();
	if (isset($all['numbers'])) {
		foreach	($all['numbers'] as $n) {
            printf("%d  %-2s  %-10s  %-15s\n", $n['msisdn'], $n['country'], $n['type'], join(',', $n['features']));
		}
	}
```

### Cancel a long virtual number

[](#cancel-a-long-virtual-number)

```
	$country = 'US';
	$msisdn = '1234567890'; // Number found using $nexmo->account->numbers()
	try {
        $response = $nexmo->number->cancel($country, $msisdn);
	} catch (Exception $e) {
        die($e->getMessage());
	}
	if (200 == $response['error-code']) {
		echo 'Number cancel success';
	}
```

Contributors
------------

[](#contributors)

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75.6% 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

Every ~13 days

Recently: every ~20 days

Total

7

Last Release

4039d ago

### Community

Maintainers

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

---

Top Contributors

[![vood](https://avatars.githubusercontent.com/u/420428?v=4)](https://github.com/vood "vood (34 commits)")[![quinncomendant](https://avatars.githubusercontent.com/u/6884276?v=4)](https://github.com/quinncomendant "quinncomendant (4 commits)")[![apeltosa](https://avatars.githubusercontent.com/u/15014021?v=4)](https://github.com/apeltosa "apeltosa (3 commits)")[![geekdevs](https://avatars.githubusercontent.com/u/864822?v=4)](https://github.com/geekdevs "geekdevs (2 commits)")[![glennjacobs](https://avatars.githubusercontent.com/u/647407?v=4)](https://github.com/glennjacobs "glennjacobs (1 commits)")[![stevro](https://avatars.githubusercontent.com/u/4375675?v=4)](https://github.com/stevro "stevro (1 commits)")

---

Tags

sdknexmolib

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/connect-corp-nexmo-client/health.svg)

```
[![Health](https://phpackages.com/badges/connect-corp-nexmo-client/health.svg)](https://phpackages.com/packages/connect-corp-nexmo-client)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k532.1M2.5k](/packages/aws-aws-sdk-php)[jlevers/selling-partner-api

PHP client for Amazon's Selling Partner API

4355.4M2](/packages/jlevers-selling-partner-api)[xeroapi/xero-php-oauth2

Xero official PHP SDK for oAuth2 generated with OpenAPI spec 3

1054.6M18](/packages/xeroapi-xero-php-oauth2)[onesignal/onesignal-php-api

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com

34199.5k2](/packages/onesignal-onesignal-php-api)

PHPackages © 2026

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