Skip to content

Douglasokolaa/termiiphp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Termii PHP

Github top language License Github issues Github forks


About   |   Requirements   |   Usage   |   Contribution   |   License   |   Author


🎯 About

PHP Library for Termii API

✅ Requirements

Before starting 🏁, you need to have Git and PHP 7+ installed.

🏁 Usage

# Installation
$ composer require okolaa/termiiphp

#Usage

  • Send sms
$termii = new Termii('TERMII_SENDER_ID', 'TERMII_API_KEY');

$sent = $termii->sendMessage(
    [
        "phone_number" => $_ENV["TEST_PHONE_NUMBER"],
        "message" => "Unit Test Message"
    ]
);
  • SendToken
$termii = new Termii('TERMII_SENDER_ID', 'TERMII_API_KEY');

//Set Options
$termii->setMaxAttempts(2);
  ->setPinTimeToLive(5);
  ->SetPinLength(4);
  ->setPinType("NUMERIC");
  ->setMaxAttempts(1);

$sent = $termii->sendToken(
    [
        "phone_number" => $_ENV["TEST_PHONE_NUMBER"],
        "message" => "Your pin is < _pin_ >"
    ]
);
  • verifyToken
$termii = new Termii('TERMII_SENDER_ID', 'TERMII_API_KEY');
$response = $termii->verifyToken(
    [
        "pin_id" => "f862cb33-9dd3-42b3-b705-18200c0e800f",
        "pin" => "1234",
    ]
);
  • InApp Token
$termii = new Termii('TERMII_SENDER_ID', 'TERMII_API_KEY');
$response = $termii->InAppToken(
    [
        "phone_number" => $_ENV["TEST_PHONE_NUMBER"],
    ]
);
  • Available Methods
$termii = new Termii('TERMII_SENDER_ID', 'TERMII_API_KEY');

$termii->sendMessage();
$termii->sendToken();
$termii->verifyToken();
$termii->InAppToken();
$termii->sendWithAutoGeneratedNumber();
$termii->getSenderIds();
$termii->getResponse();
$termii->setMaxAttempts();
$termii->setPinTimeToLive();
$termii->setPinType();
$termii->setChannel();
$termii->SetPinPlaceholder();
$termii->setMessageType();
$termii->setTokenMessageType();
$termii->SetPinLength();
$termii->setSender();
$termii->setAPIKey();
$termii->getSenderIds();
$termii->getBallance();
$termii->search();

🔨 Countribution

# fork and Clone the fork project
# Access the folder
$ cd termiiphp

# Install dependencies
$ composer Install

# Create .env and update
$ cp .ev.example .env

# Run test
$ ./vendor/phpunit/phpunit/phpunit tests

📝 License

This project is under license from MIT. For more details, see the LICENSE file.

Made with ❤️ by Douglas Okolaa

 

Todo:

  • Update Readme with Usage

Back to top