PHPackages                             messageway/messagewayphp - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. messageway/messagewayphp

ActiveLibrary[Queues &amp; Workers](/categories/queues)

messageway/messagewayphp
========================

This SDK allows you to connect to MSGWay.com server from your php application.

v2.1.0(1y ago)08.8k↓70.8%11MITPHPPHP &gt;=7.4

Since Apr 19Pushed 1y ago1 watchersCompare

[ Source](https://github.com/MessageWay/MessageWayPHP)[ Packagist](https://packagist.org/packages/messageway/messagewayphp)[ Docs](https://MSGway.com)[ RSS](/packages/messageway-messagewayphp/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (1)Versions (11)Used By (1)

[![messageWay](examples/assets/logo.png)](examples/assets/logo.png)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ee991f143d0e82b91fac7217a0a6e079bd08bea02a8210602fa22f2109b1813d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6573736167657761792f4d6573736167655761795048502e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/messageway/messagewayphp)[![Total Downloads](https://camo.githubusercontent.com/ae578f07356a69c4097a3e077c9646fdec3dd290bac180b33a1979c84e9e2fc7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6573736167657761792f4d6573736167655761795048502e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/messageway/messagewayphp)[![Swagger](https://camo.githubusercontent.com/903160c26864be145ca7a1ce5c004911a01fc273593b71f2de50dce34b5f8cbe/68747470733a2f2f696d672e736869656c64732e696f2f737761676765722f76616c69642f332e303f7370656355726c3d6874747073253341253246253246646f632e6d73677761792e636f6d253246737761676765722e6a736f6e267374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/903160c26864be145ca7a1ce5c004911a01fc273593b71f2de50dce34b5f8cbe/68747470733a2f2f696d672e736869656c64732e696f2f737761676765722f76616c69642f332e303f7370656355726c3d6874747073253341253246253246646f632e6d73677761792e636f6d253246737761676765722e6a736f6e267374796c653d666f722d7468652d6261646765)[![MessageWay](https://camo.githubusercontent.com/8b688d217f6757adf0eb9d47e8b86b068459fcc7b3eb8f01065bc8ace2dc7ca6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2d4d53475761792e636f6d2d637269746963616c3f6c696e6b3d68747470733a2f2f4d53475761792e636f6d267374796c653d666f722d7468652d6261646765)](https://MSGWay.com/)

MessageWay PHP SDK
==================

[](#messageway-php-sdk)

A PHP SDK for the MessageWay API. ([فارسی 🇮🇷](https://github.com/MessageWay/MessageWayPHP/blob/main/README-fa.md))

Available Methods
-----------------

[](#available-methods)

- SMS (Iran: 2000, 3000, 9000, 50004)
- Global SMS (with Twilio)
- Messenger
    - [Whatsapp](https://whatsapp.com) Messenger
    - [Gap](https://gap.im) Messenger
    - [iGap](https://igap.net) Messenger
- IVR

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

[](#requirements)

- PHP 7.4 or higher
- ext-curl
- ext-json
- composer

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

[](#installation)

### with Composer

[](#with-composer)

```
$ composer require messageway/messagewayphp
```

#### Require

[](#require)

```
require dirname(__FILE__) . '/../vendor/autoload.php';
use MessageWay\Api\MessageWayAPI;

// Get apiKey from https://MSGWay.com/dashboard/document/
$apiKey = "";
$mobile = "";
$templateID = 3;
$messageWay = new MessageWayAPI($apiKey);
```

### without Composer

[](#without-composer)

```
$ git clone git@github.com:MessageWay/MessageWayPHP.git
```

#### Require

[](#require-1)

```
require dirname(__FILE__) . '/MessageWayPHP/src/MessageWayAPI.php';
use MessageWay\Api\MessageWayAPI;

// Get apiKey from https://MSGWay.com/dashboard/document/
$apiKey = "";
$mobile = "";
$templateID = 3;
$messageWay = new MessageWayAPI($apiKey);
```

---

Send OTP
--------

[](#send-otp)

### By SMS

[](#by-sms)

```
try {
	$otp = $messageWay->sendViaSMS($mobile, $templateID);
	echo "referenceID: " . $otp['referenceID'] . PHP_EOL;
	echo "sender: " . $otp['sender'] . PHP_EOL;
} catch (Exception $e) {
	echo "Error: " . $e->getMessage();
}
```

### By Messenger

[](#by--messenger)

```
try {
	$provider = $messageWay->getProviderByName('gap');
	$otp = $messageWay->sendViaMessenger($mobile, $templateID, $provider);
	echo "referenceID: " . $otp['referenceID'] . PHP_EOL;
	echo "sender: " . $otp['sender'] . PHP_EOL;
} catch (Exception $e) {
	echo "Error: " . $e->getMessage();
}
```

### By IVR

[](#by--ivr)

```
$templateID = 2;
try {
	$otp = $messageWay->sendViaIVR($mobile, $templateID);
	echo "referenceID: " . $otp['referenceID'] . PHP_EOL;
	echo "sender: " . $otp['sender'] . PHP_EOL;
} catch (Exception $e) {
	echo "Error: " . $e->getMessage();
}
```

---

Verify
------

[](#verify)

```
try {
	$verify = $messageWay->verifyOTP($OTP, $mobile);
	echo "OTPVerify: " . $verify['status'] . PHP_EOL;
} catch (Exception $e) {
	echo "Error: " . $e->getMessage();
}
```

---

Status
------

[](#status)

```
try {
	$status = $messageWay->getStatus($OTPRefrenceID);
    echo "OTPStatus: " . $status['OTPStatus'] . PHP_EOL;
	echo "OTPVerified: " . $status['OTPVerified'] . PHP_EOL;
	echo "OTPMethod: " . $status['OTPMethod'] . PHP_EOL;
} catch (Exception $e) {
	echo "Error: " . $e->getMessage();
}
```

---

Balance
-------

[](#balance)

```
try {
	$balance = $messageWay->getBalance();
    echo "Balance: " . $balance;
} catch (Exception $e) {
	echo "Error: " . $e->getMessage();
}
```

---

Get Template
------------

[](#get-template)

```
$templateID = 2;
try {
	$template = $messageWay->getTemplate($templateID);
	echo "Template: " . $template['template'] . PHP_EOL;
	echo "Params: " . implode(", ", $template['params']) . PHP_EOL;
} catch (Exception $e) {
	echo "Error: " . $e->getMessage();
}
```

---

License
-------

[](#license)

MIT

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~110 days

Recently: every ~212 days

Total

10

Last Release

544d ago

Major Versions

v1.1.4 → v2.0.02023-10-29

### Community

Maintainers

![](https://www.gravatar.com/avatar/d2cbb1d9de958fc002f6d61c1cdd35e7cb66bd86204c40ff5d127848d63ac27a?d=identicon)[ehsansabet](/maintainers/ehsansabet)

---

Top Contributors

[![ehsansabet](https://avatars.githubusercontent.com/u/5628902?v=4)](https://github.com/ehsansabet "ehsansabet (21 commits)")

---

Tags

messageotpsmsivr

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/messageway-messagewayphp/health.svg)

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

###  Alternatives

[php-amqplib/php-amqplib

Formerly videlalvaro/php-amqplib. This library is a pure PHP implementation of the AMQP protocol. It's been tested against RabbitMQ.

4.6k132.3M1.0k](/packages/php-amqplib-php-amqplib)[aws/aws-php-sns-message-validator

Amazon SNS message validation for PHP

22223.4M118](/packages/aws-aws-php-sns-message-validator)[phlib/sms-length

SMS Length calculations, using GSM 03.38 and GSM 03.40

14894.3k2](/packages/phlib-sms-length)[fotografde/cakephp-sms

SMS Plugin for CakePHP

1473.2k](/packages/fotografde-cakephp-sms)

PHPackages © 2026

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