PHPackages                             olusegun171/laravel-termii - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. olusegun171/laravel-termii

ActiveLibrary

olusegun171/laravel-termii
==========================

Termii Laravel package

0113—0%PHP

Since Aug 3Pushed 1y ago1 watchersCompare

[ Source](https://github.com/olusegun171/laravel-termii)[ Packagist](https://packagist.org/packages/olusegun171/laravel-termii)[ RSS](/packages/olusegun171-laravel-termii/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Termii API for Laravel
======================

[](#termii-api-for-laravel)

This is a laravel package for [Termii API](http://developer.termii.com/docs/)

---

Requirements
------------

[](#requirements)

```
- Php >= 8.0
- Laravel 9.0 or higher

```

Installation
------------

[](#installation)

```
composer require olusegun171/laravel-termii
```

Once the Laravel package is installed, Open your .env file and add the following variables. Get your API key from

```
TERMII_SENDER_ID="N-Alert"
TERMII_API_KEY=""
TERMII_BASE_URL = "https://api.ng.termii.com"

```

Usage
-----

[](#usage)

To use any of the Termii's API, First, add the LaravelTermii\\Termii class

```
  use LaravelTermii\Termii;
```

#### 1. Messaging API

[](#1-messaging-api)

To use the Termii’s Messaging API, first create an instance with

```
  $messaging = Termii::messaging();
```

- ##### Send message

    [](#send-message)

Send message with the default senderID 'N-Alert'.

```
  $channel = 'generic';  //default is 'generic' or pass 'dnd' to send dnd message
  $response = $messaging->sendMessage(string $to, string $message, string $channel);
  $response->json();
```

- ##### Send bulk message

    [](#send-bulk-message)

Send bulk message with the default senderID 'N-Alert'.

```
  $channel = 'generic';  //default is 'generic' or pass 'dnd' to send dnd message
  $messaging->sendBulkMessage($to, string $mesage);
```

- ##### Auto-generated messaging numbers

    [](#auto-generated-messaging-numbers)

send messages to customers using Termii's auto-generated messaging numbers that adapt to customers location. For more information visit

```
  $response = $messaging->sendNumber(string $to, string $message);
  $response->json();
```

- ##### Whatsapp message

    [](#whatsapp-message)

Send whatsapp message with default device name 'N-Alert'

```
  //The url to the file resource and caption that should be added to the image,
  $media  = ['url' => '','caption' => '' ];
  $device_name = 'N-Alert'; // you can pass another approved device name.
  $response = $messaging->sendWhatapps(string $to, string $device_name, array $media);
  $response->json();
```

- ##### Send Template

    [](#send-template)

Set a template for the one-time-passwords (pins) sent to customers via whatsapp or sms. For more information visit

```
/* $data = [
         "product_name": "Termii",
         "otp" : 120435,
         "expiry_time": "10 minutes"
] */
  $response = $messaging->sendTemplate(string $to, string $template_id, string $device_id, array $data);
  $response->json();
```

- ##### Phonebook

    [](#phonebook)

Create, view &amp; manage phonebooks using these methods. Each phonebook can be identified by a unique ID, which makes it easier to edit or delete a phonebook.

```
//get all phonebooks
$response = $messaging->phonebooks();
$response->json();

//create phonebook
$response = $messaging->createPhoneBook(string $phonebook_name, string $desc = '');
$response->json();

//update phonebook
$response = $messaging->updatePhoneBook(string $phonebook_id, string $phonebook_name);
$response->json();

//Delete phonebook
$response = $messaging->deletePhoneBook(string $phonebook_id);
$response->json();
```

- ##### Contacts

    [](#contacts)

Manage contacts in your phonebook.

```
//Fetch contacts by phonebook ID
$response = $messaging->PhonebookContacts(string $phonebook_id);
$response->json();

//Add single contact to a phonebook
  /* $contact = [
        "phone_number" => "8123696237",
        "email_address" => "test@gmail.com",
        "first_name" =>  "test",
        "last_name" =>  "contact",
        "company" => "Termii",
        "country_code" => "234"
   ]; */
$response = $messaging->addContact(string $phonebook_id, array $contact);
$response->json();

//Add multiple contacts to a phonebook
  /*
    file containing the list of contacts. Supported files include : 'txt', 'xlsx', and 'csv'.
    $contact_file = 'test_names.csv";
    $country_code = "234";
    */
$response = $messaging->addMutipleContacts(string $phonebook_id, string $contact_file, string $country_code);
$response->json();
//Delete a contact
$response = $messaging->deleteContact(string $contact_id);
$response->json();
```

- ##### Campaigns

    [](#campaigns)

View, manage and send a campaign to a phonebook

```
//Fetch campaigns
$response = $messaging->campaigns();
$response->json();

//Fetch campaign history
$response = $messaging->campaignHistory(string $campaign_id);
$response->json();

//Send a campaign with default senderID 'N-Alert'
/*
$channel = 'generic';
$schedule = [
    "schedule_sms_status" => "scheduled" // To send a scheduled campaign, pass scheduled as the value
    "schedule_time" => "30-06-2021 6:00", //The date time to send scheduled campaign
]; */

$response = $messaging->sendCampaign(string $phonebook_id, string $message, string $channel, array $schedule = []);
$response->json();
```

- ##### Request Sender ID

    [](#request-sender-id)

Use this method to request a new sender ID from your Termii account

```
  $response = $messaging->requestSenderID(string $sender_id, string $usecase, string $company);
  $response->json();
```

- ##### Fetch Sender ID

    [](#fetch-sender-id)

Use this method to fetch all sender IDs in your Termii account

```
  $response = $messaging->fetchSenderID();
  $response->json();
```

#### 2. Token API

[](#2-token-api)

To use the Termii’s Token API, first create an instance with the following

```
  $token = Termii::token(["pin_attempts" => 10,
                            "pin_time_to_live" => 30,
                            "pin_length" => 6,
                            "pin_placeholder" => '< 123 >',
                            'pin_type' => 'ALPHANUMERIC',
                            'message_type' => 'ALPHANUMERIC',
                        ]);
```

- ##### Send Token

    [](#send-token)

Trigger one-time-passwords (OTP) across any available messaging channel on Termii. One-time-passwords created are generated randomly and there's an option to set an expiry time.

```
$response = $token->sendToken(string $to, string $from, string $mesage, string  $channel = 'generic');
$response->json();
```

- ##### Send Voice Token

    [](#send-voice-token)

Generate and trigger one-time passwords (OTP) through the voice channel to a phone number. OTPs are generated and sent to the phone number and can be verified calling *wverifyToken* method

```
$response = $token->voiceToken(string $phone_number);
$response->json();
```

- ##### Send Voice Call

    [](#send-voice-call)

Send messages from your application through our voice channel to a phone number. Only one-time-passwords (OTP) are allowed for now and these OTPs can not be verified

```
$response = $token->voiceCall(string $phone_number,  string $code);
$response->json();
```

- ##### Send Email Token

    [](#send-email-token)

Send one-time-passwords from your application through our email channel to an email address. Only one-time-passwords (OTP) are allowed for now and these OTPs can not be verified

```
$response = $token->emailToken(string $email,  string $code, $config_id);
$response->json();
```

- ##### Verify Token

    [](#verify-token)

Checks tokens sent to customers and returns a response confirming the status of the token. A token can either be confirmed as verified or expired based on the timer set for the token.

```
$response = $token->verifyToken(string $pin_id,  string $pin);
$response->json();
```

- ##### In-App Token

    [](#in-app-token)

Returns OTP codes in JSON format which can be used within any web or mobile app. Tokens are numeric or alpha-numeric codes generated to authenticate login requests and verify customer transactions.

```
$response = $token->inAppToken(string $phone_number);
$response->json();
```

#### 3. Insight API

[](#3--insight-api)

To use the Termii’s Insight API, first create an instance with the following

```
  $insight = Termii::insights();
```

- ##### Account Balance

    [](#account-balance)

Returns your total balance and balance information from your wallet, such as currency.

```
$response = $insight->balance();
$response->json();
```

- ##### Search

    [](#search)

To verify phone numbers and automatically detect their status as well as current network. It also tells if the number has activated the do-not-disturb settings.

```
$response = $insight->search(string $phone_number);
$response->json();
```

- ##### Status

    [](#status)

Check if a number is fake or has ported to a new network.

```
$response = $insight->status(string $phone_number, string $country_code = 'NG');
$response->json();
```

- ##### History

    [](#history)

Returns reports for messages sent across the sms, voice &amp; whatsapp channels. Reports can either display all messages on termii or a single message. This returns your total balance and balance information from your wallet, such as currency.

```
$response = $insight->history();
$response->json();
```

#### Other Response methods

[](#other-response-methods)

```
$response->body() : string;

$response->json($key = null, $default = null) : mixed;

$response->object() : object;

// Returns http status code
$response->status() : int;

// Determine if the status code is >= 200 and < 300...
$response->successful();

// Determine if the status code is >= 400...
$response->failed();

// Determine if the response has a 400 level status code...
$response->clientError();

// Determine if the response has a 500 level status code...
$response->serverError();
```

License
-------

[](#license)

This project is under license from MIT. For more details, see the [LICENSE](LICENSE.md) file.

[Back to top](#top)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity17

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/29a67a1b138b9b3c10df36992ce98101e4d6227886e14766122b1bae92fbc949?d=identicon)[olusegun171](/maintainers/olusegun171)

---

Top Contributors

[![olusegun171](https://avatars.githubusercontent.com/u/21316856?v=4)](https://github.com/olusegun171 "olusegun171 (3 commits)")

### Embed Badge

![Health badge](/badges/olusegun171-laravel-termii/health.svg)

```
[![Health](https://phpackages.com/badges/olusegun171-laravel-termii/health.svg)](https://phpackages.com/packages/olusegun171-laravel-termii)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
