Website | Support | Contact | Contributing
nomado is a telephony and SMS solution for businesses and private customers. Our goal is to provide super user-friendly tools to meet your growing needs of nomadism.
This package provides a client to access the nomado API.
composer require nomado/nomado
Below is a quick example for initializing the library and sending a SMS.
require('vendor/autoload.php');
$credentials = [
'username' => 'username',
'password' => 'password'
];
$nomado = new \nomado\Client($credentials);
$response = $nomado->sms->send([
'to' => [32123456789],
'message' => 'Hello World'
]);
// response object
var_dump($response);
The \nomado\Client
class provides the public interfaces to access the nomado API
SMS
OTP
Calls
HLR
Account
First, initialize the library with your nomado credentials.
$nomado = new \nomado\Client(['username' => 'username',
'password' => 'password'
]);
Now, you can start sending requests to the API.
Every call will return a Response
object wrapping the API response code and the data.
// Result object:
{
code: 200,
reason: "", //in case of error
data: {}
}
Send
Send a SMS to one or multiple numbers.
$nomado->sms->send([
'to' => ['3245678901','3245678902'], // e164 formatted numbers
'message' => 'Bonjour le monde',
'unicode' => false
]);
// example response object
{
code: 200,
data: {
callerID: 'NOMADO',
text: 'Bonjour le monde',
unicode: 0,
'3245678901': { ... },
'3245678902': { ... }
},
cost: 0.16,
total_sms: 2,
}
If you are sending unicode SMS, don't forget to turn on the unicode
flag, otherwise encoding problems may occur.
Sending 2FA code via SMS to your users without the hassle.
Send
$nomado->otp->send([
'to' => '3245678901', // e164 formatted number
'template' => 'Your verification code is {{CODE}}.',
'type' => 'ALPHANUMERIC', // optional, ALPHA, NUMERIC or ALPHANUMERIC (default)
'length' => 4, // optional, defaults to 4
'expiry' => 7200 // optional, defaults to 7200 seconds (2 hours)
])
In the template, {{CODE}}
will be replaced by the generated 2FA code.
Verify
Let's check the code entered by your user.
$nomado->otp->verify([
'number' => '3245678901', // their phone number,
'token' => '456789' // their code
])
// expected response object
{
code: 200,
data: {
verify: true
}
}
Once the code has been verified, it becomes invalidated.
Make
Makes a call to a telephone line or number. When it answers, makes a second call to a number, bridging both calls together.
$nomado->calls->make([
'cnumber' => '3245678901',
'snumber' => '3245678902'
]);
// example response object
{
code: 200
}
Make HLR queries to any mobile number.
Fetch
$nomado->hlr->fetch({
'numbers' => ['3245678901','3245678902'], // e164 formatted numbers
});
// example response object
{
code: 200,
data: {
'3245678901': { ... },
'3245678902': { ... },
valid_numbers: 2
},
cost: 0.05,
}
Validate
Free query to validate mobile phone numbers and get short information
$nomado->hlr->validate({
'number' => '3245678901', // e164 formatted number
});
// example response object
{
code: 200,
data: {
Status: 'Valid',
Region: 'BE',
...
}
}
Easy way to check your current balance
Get balance
$nomado->account->getBalance();
// example response object
{
code: 200,
data: {
balance: '95.740418'
}
}
You are welcome to contribute in several ways like creating new features, fixing bugs, improving documentation, translating etc... More information in CONTRIBUTING.md.
We are a small team dedicated to offer you the best support because we want to satisfy you. For any problem or question, feel free to contact us.