Send SMS with Notify.lk
This PHP package is automatically generated by the Swagger Codegen project:
- API version: v1
- Package version: 1.0
- Build package: class io.swagger.codegen.languages.PhpClientCodegen
PHP 5.4.0 and later
Important
Please avoid sending OTP content with our DEMO sender name. If you want to test OTP please get you own Sender ID approved first and start. Otherwise there's a risk of getting your account suspended.
Also, even after getting your own name please use your app website or brand name in the SMS content as well to continue successful delivery.
Eg: Please use the code 111111 to verify your ABC account.
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/notifylk/notify-php.git"
}
],
"require": {
"notifylk/notify-php": "*@dev"
}
}
Then run composer install
Download the files and include autoload.php
:
require_once('/path/to/NotifyLk/autoload.php');
To run the unit tests:
composer install
./vendor/bin/phpunit
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new NotifyLk\Api\SmsApi();
$user_id = "user_id_example"; // string | API User ID - Can be found in your settings page.
$api_key = "api_key_example"; // string | API Key - Can be found in your settings page.
$message = "message_example"; // string | Text of the message. 320 chars max.
$to = "9471XXXXXXX"; // string | Number to send the SMS. Better to use 9471XXXXXXX format.
$sender_id = "NotifyDEMO"; // string | This is the from name recipient will see as the sender of the SMS. Use \\\"NotifyDemo\\\" if you have not ordered your own sender ID yet.
$contact_fname = ""; // string | Contact First Name - This will be used while saving the phone number in your Notify contacts (optional).
$contact_lname = ""; // string | Contact Last Name - This will be used while saving the phone number in your Notify contacts (optional).
$contact_email = ""; // string | Contact Email Address - This will be used while saving the phone number in your Notify contacts (optional).
$contact_address = ""; // string | Contact Physical Address - This will be used while saving the phone number in your Notify contacts (optional).
$contact_group = 0; // int | A group ID to associate the saving contact with (optional).
$type = null; // string | Message type. Provide as unicode to support unicode (optional).
try {
$api_instance->sendSMS($user_id, $api_key, $message, $to, $sender_id, $contact_fname, $contact_lname, $contact_email, $contact_address, $contact_group, $type);
} catch (Exception $e) {
echo 'Exception when calling SmsApi->sendSMS: ', $e->getMessage(), PHP_EOL;
}
?>
All URIs are relative to https://app.notify.lk/api/v1
Class | Method | HTTP request | Description |
---|---|---|---|
SmsApi | sendSMS | POST /send | Sending SMS to a number from specified sender ID |
All endpoints do not require authorization.