Skip to content

Commit 6309bdd

Browse files
authored
Merge pull request #180 from Nexmo/markl-update-readme-numbers
Update README with Numbers API examples
2 parents 182d41a + 5fbad43 commit 6309bdd

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

README.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Nexmo Client Library for PHP
1+
Client Library for PHP
22
============================
33
[![Build Status](https://api.travis-ci.org/Nexmo/nexmo-php.svg?branch=master)](https://travis-ci.org/Nexmo/nexmo-php)
44
[![Latest Stable Version](https://poser.pugx.org/nexmo/client/v/stable)](https://packagist.org/packages/nexmo/client)
@@ -513,6 +513,24 @@ $application = $client->applications()->update([
513513
], '1a20a124-1775-412b-b623-e6985f4aace0');
514514
```
515515

516+
### List Your Numbers
517+
518+
You can list the numbers owned by your account and optionally include filtering:
519+
520+
`search_pattern`:
521+
* `0` - the number begins with `pattern`
522+
* `1` - the number includes `pattern`
523+
* `2` - the number ends with `pattern`
524+
525+
```
526+
$client->numbers()->searchOwned(
527+
'234',
528+
[
529+
"search_pattern" => 1,
530+
]
531+
);
532+
```
533+
516534
### Search Available Numbers
517535

518536
You can search for numbers available to purchase in a specific country:
@@ -536,6 +554,30 @@ Or you can specify the number and country manually:
536554
$client->numbers()->purchase('14155550100', 'US');
537555
```
538556

557+
### Update a Number
558+
559+
To update a number, use `numbers()->update` and pass in the configuration options you want to change. To clear a setting, pass in an empty value.
560+
561+
```php
562+
$client->numbers()->update([
563+
"messagesCallbackType" => "app",
564+
"messagesCallbackValue" => '1a20a124-1775-412b-b623-e6985f4aace0',
565+
"voiceCallbackType" => 'tel',
566+
"voiceCallbackValue" => '447700900002',
567+
"voiceStatusCallback" => 'https://example.com/webhooks/status',
568+
"moHttpUrl" => 'https://example.com/webhooks/inbound-sms',
569+
], NEXMO_NUMBER);
570+
```
571+
572+
### Cancel a Number
573+
574+
To cancel a number, provide the `msisdn`:
575+
576+
```php
577+
$client->numbers()->cancel('447700900002');
578+
```
579+
580+
539581
### Managing Secrets
540582

541583
An API is provided to allow you to rotate your API secrets. You can create a new secret (up to a maximum of two secrets) and delete the existing one once all applications have been updated.

0 commit comments

Comments
 (0)