Skip to content

notifylk/notify-php

Repository files navigation

NotifyLk

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

Requirements

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.

Installation & Usage

Composer

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

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/NotifyLk/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

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;
}

?>

Documentation for API Endpoints

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

Documentation For Models

Documentation For Authorization

All endpoints do not require authorization.

Author