PHPackages                             direct7/direct7-php - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. direct7/direct7-php

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

direct7/direct7-php
===================

Direct7 SDK for PHP

0.0.19(1y ago)02.7k↓25%MITPHPPHP ^8.1.2

Since Nov 1Pushed 1y ago1 watchersCompare

[ Source](https://github.com/d7networks/direct7-php-sdk)[ Packagist](https://packagist.org/packages/direct7/direct7-php)[ Docs](https://d7networks.com/)[ RSS](/packages/direct7-direct7-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (17)Used By (0)

Direct7 PHP SDK
===============

[](#direct7-php-sdk)

PHP SDK to seamlessly incorporate communication features into your PHP applications via the Direct7 REST API. This SDK empowers you to effortlessly initiate SMS,Whatsapp, Slack, Viber messages and 2 factor authentication features.

Documentation
-------------

[](#documentation)

The documentation for the Direct7 REST API can be found here [Direct7 API Reference](https://d7networks.com/docs/).

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

[](#installation)

Install the SDK using [Composer](http://getcomposer.org/). Run the following command from project root directory:

```
composer require direct7/direct7-php
```

To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading):

```
require_once 'vendor/autoload.php';
```

Usage
-----

[](#usage)

To get started you need to have an active Direct7 account, If you haven't yet registered, please proceed to [Sign up](https://app.d7networks.com/signup?tag=%22direct7-php-sdk%22)

### Authentication

[](#authentication)

In order to initiate API requests, create a client object using your Direct7 API token. To obtain an API token, kindly visit the following link: .

```
require_once __DIR__ . '/vendor/autoload.php';
use direct7\Direct7\Client;

$direct7 = new Client(api_token="Your API token")
```

Examples
--------

[](#examples)

- [SMS](#sms)
- [Verify](#verify)
- [Whatsapp](#whatsapp)
- [Number Lookup](#number-lookup)
- [Viber](#viber)
- [Slack](#slack)

### SMS

[](#sms)

### Send SMS

[](#send-sms)

```
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$direct7 = new Client(api_token="Your API token");

$response = $direct7->sms->sendMessage(
        'Sender',
        'https://example.com/callback',
        '2024-02-05T10:17:10+0000',
        [
            'recipients' => ["+91999XXXXXXX"],
            'content' => 'Greetings from D7 API',
            'unicode' => false,
        ],
    );
var_dump($response);
```

### Send SMS (Unicode)

[](#send-sms-unicode)

```
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$client = new Client(api_token="Your API token")

$response = $direct7->sms->sendMessage(
        'Sender',
        'https://example.com/callback',
        null,
        [
            'recipients' => ["+919999XXXXXX"],
            'content' => 'لوحة المفاتيح العربية!',
            'unicode' => true,
        ]
    );
var_dump($response);
```

### Check Request Status

[](#check-request-status)

```
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$direct7 = new Client(api_token="Your API token");

# request_id is the id returned in the response of send_message
 $response = $direct7->sms->getStatus(request_id:'00145469-b503-440a-bb0c-59af8a598a7f');

var_dump($response);
```

### Verify

[](#verify)

### Send OTP

[](#send-otp)

```
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$direct7 = new Client(api_token="Your API token");

$response = $direct7->verify->sendOtp(originator:'SignOTP', recipient:'+91999999XXXX', content:'Greetings from D7 API, your mobile verification code is: {}', data_coding:'text', expiry:600);

var_dump($response);
```

### Re-Send OTP

[](#re-send-otp)

```
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$direct7 = new Client(api_token="Your API token");

$response = $direct7->verify->resendOtp(otpId:'9c476ed0-c1ce-43e2-8576-ec505902e987');

var_dump($response);
```

### Verify OTP

[](#verify-otp)

```
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$direct7 = new Client(api_token="Your API token");

$response = $direct7->verify->verifyOtp(otpId:'31b89954-d37c-426f-8113-ac718afc5d4c', otpCode:'429766');
var_dump($response);
```

### Check OTP Request Status

[](#check-otp-request-status)

```
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$direct7 = new Client(api_token="Your API token");

$response = $direct7->verify->getStatus(otpId:'31b89954-d37c-426f-8113-ac718afc5d4c');
var_dump($response);
```

### Whatsapp

[](#whatsapp)

### Send Whatsapp Free-form Message (Location Details)

[](#send-whatsapp-free-form-message-location-details)

```
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$direct7 = new Client(api_token="Your API token");

$response = $direct7->whatsapp->sendWhatsAppFreeformMessage(
        originator:"9715XXXXXXX",
        recipient:"91XX8675XXXX",
        message_type:"LOCATION",
        latitude: "12.93803129081362",
        longitude: "77.61088653615994",
        name: "Pvt Ltd",
        address: "Bengaluru, Karnataka"
      );

var_dump($response);
```

### Send Whatsapp Templated Message.

[](#send-whatsapp-templated-message)

```
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$direct7 = new Client(api_token="Your API token");

$body_parameter_values = ["0" => 'first_parameter_in_your_template'];

$response = $direct7->whatsapp->sendWhatsAppTemplatedMessage(
    originator: '9715XXXXXXX',
    recipient: '91XX8675XXXX',
    language: 'en',
    template_id: 'template_id',
    body_parameter_values: $body_parameter_values,
);

var_dump($response);
```

### Send Whatsapp Interactive Message.

[](#send-whatsapp-interactive-message)

```
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$direct7 = new Client(api_token="Your API token");

$parameters = [
        "display_text" => "Visit Us",
        "url" => "https://www.luckyshrub.com?clickID=kqDGWd24Q5TRwoEQTICY7W1JKoXvaZOXWAS7h1P76s0R7Paec4"
      ];

$response = $direct7->whatsapp->sendWhatsAppInteractiveMessage(
    originator:"9715XXXXXXX",
    recipient:"91XX8675XXXX",
    interactive_type:"cta_url",
    header_type:"text",
    header_text:"Payment$ for D7 Whatsapp Service",
    body_text:"Direct7 Networks is a messaging service provider that specializes in helping organizations efficiently communicate with their customers.",
    footer_text:"Thank You",
    parameters: $parameters
);
```

### Check Whatsapp Request Status

[](#check-whatsapp-request-status)

```
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$direct7 = new Client(api_token="Your API token");

$response = $direct7->whatsapp->getStatus('469affd7-0983-4bbc-9d07-ee43e1d1cfef');

var_dump($response);
```

### Whatsapp Read Receipt

[](#whatsapp-read-receipt)

```
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$direct7 = new Client(api_token="Your API token");

$response = $direct7->whatsapp->readReceipt('469affd7-0983-4bbc-9d07-ee43e1d1cfef');

var_dump($response);
```

### Whatsapp Download User Initiated Media

[](#whatsapp-download-user-initiated-media)

```
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$direct7 = new Client(api_token="Your API token");

$response = $direct7->whatsapp->downloadMedia('16534343434');

var_dump($response);
```

### Number Lookup

[](#number-lookup)

### Search Phone Number Details

[](#search-phone-number-details)

```
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$direct7 = new Client(api_token="Your API token");

$response = $direct7->number_lookup->searchNumberDetails(recipient:'+91999999XXXX');
var_dump($response);
```

### Viber

[](#viber)

### Send Viber Message

[](#send-viber-message)

```
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$direct7 = new Client(api_token="Your API token");

$response = $direct7->viber->sendViberMessage(recipients:['+91999999XXXX'], content:'Hello, World!', label:'PROMOTION', originator:'SignOTP', call_back_url:'https://example.com/callback');
var_dump($response);
```

### Check Request Status

[](#check-request-status-1)

```
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$direct7 = new Client(api_token="Your API token");

$response = $direct7->viber->getStatus(request_id:'deb7c268-cde9-4782-a4a7-9bc03a82bd1d');
var_dump($response);
```

### Slack

[](#slack)

### Send Slack Message

[](#send-slack-message)

```
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$direct7 = new Client(api_token="Your API token");

$response = $direct7->slack->sendSlackMessage(content:'Hello, World!', work_space_name:'WorkSpaceName', channel_name:'ChannelName', report_url:'https://example.com/callback');
var_dump($response);
```

### Check Slack Request Status

[](#check-slack-request-status)

```
require_once __DIR__ . '/vendor/autoload.php';

use direct7\Direct7\Client;

$direct7 = new Client(api_token="Your API token");

$response = $direct7->viber->getStatus(request_id:'deb7c268-cde9-4782-a4a7-9bc03a82bd1d');
var_dump($response);
```

FAQ
---

[](#faq)

### How do I get my API token?

[](#how-do-i-get-my-api-token)

You can get your API token from the Direct7 dashboard. If you don't have an account yet, you can create one for free.

### Supported php versions

[](#supported-php-versions)

The SDK supports php 8.1.2 and higher.

### Supported APIs

[](#supported-apis)

As of now, the SDK supports the following APIs:

APISupported?SMS API✅Verify API✅Whatsapp API✅Number Lookup API✅Viber API✅Slack API✅### How do I get started?

[](#how-do-i-get-started)

You can find the platform documentation @ [Direct7 Docs](https://d7networks.com/docs/).

### How do I get help?

[](#how-do-i-get-help)

If you need help using the SDK, you can create an issue on GitHub or email to

Contributing
------------

[](#contributing)

We welcome contributions to the Direct7 PHP SDK. If you have any ideas for improvements or bug fixes, please feel free to create an issue on GitHub.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance50

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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.

###  Release Activity

Cadence

Every ~40 days

Recently: every ~47 days

Total

15

Last Release

365d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6b10dfe737db54e0f910b2a10873341641fde225ec7eeb2db7effb747513898f?d=identicon)[direct7](/maintainers/direct7)

---

Top Contributors

[![Sisira-D7](https://avatars.githubusercontent.com/u/124143579?v=4)](https://github.com/Sisira-D7 "Sisira-D7 (12 commits)")[![SteniMariyaThomas](https://avatars.githubusercontent.com/u/101807451?v=4)](https://github.com/SteniMariyaThomas "SteniMariyaThomas (7 commits)")[![mknithin](https://avatars.githubusercontent.com/u/15276904?v=4)](https://github.com/mknithin "mknithin (4 commits)")[![midhunsigntaper](https://avatars.githubusercontent.com/u/193886827?v=4)](https://github.com/midhunsigntaper "midhunsigntaper (2 commits)")[![vishnu-signtaper](https://avatars.githubusercontent.com/u/178157063?v=4)](https://github.com/vishnu-signtaper "vishnu-signtaper (1 commits)")

---

Tags

otpslackverify2fasmsREST APIwhatsappviberd7direct7number lookup

### Embed Badge

![Health badge](/badges/direct7-direct7-php/health.svg)

```
[![Health](https://phpackages.com/badges/direct7-direct7-php/health.svg)](https://phpackages.com/packages/direct7-direct7-php)
```

###  Alternatives

[infobip/infobip-api-php-client

PHP library for consuming Infobip's API

921.8M10](/packages/infobip-infobip-api-php-client)[ellaisys/aws-cognito

AWS Cognito package that allows Auth and other related features using the AWS SDK for PHP

120220.7k1](/packages/ellaisys-aws-cognito)[chillerlan/php-authenticator

A generator for counter- and time based 2-factor authentication codes (Google Authenticator). PHP 8.2+

58119.1k2](/packages/chillerlan-php-authenticator)[erkens/2fa-text

Extends scheb/2fa-bundle with two-factor authentication via simple text messages

15209.8k](/packages/erkens-2fa-text)[remotemerge/totp-php

Lightweight, fast, and secure TOTP (2FA) authentication library for PHP — battle tested, dependency free, and ready for enterprise integration.

2010.2k](/packages/remotemerge-totp-php)[alexgeno/phone-verification-laravel

A library for phone verification via Laravel notification channels. Any notification channel can be used as a sender, and Redis or MongoDB can be used as a storage.

112.4k](/packages/alexgeno-phone-verification-laravel)

PHPackages © 2026

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