PHPackages                             msgly-official/msgly-sdk-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. msgly-official/msgly-sdk-php

ActiveLibrary

msgly-official/msgly-sdk-php
============================

PHP SDK for Msgly API

v1.0.1(today)03↑2900%PHPPHP &gt;=7.4

Since Aug 1Pushed todayCompare

[ Source](https://github.com/msgly-official/msgly-sdk-php)[ Packagist](https://packagist.org/packages/msgly-official/msgly-sdk-php)[ RSS](/packages/msgly-official-msgly-sdk-php/feed)WikiDiscussions main Synced today

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

Msgly PHP SDK
=============

[](#msgly-php-sdk)

Official PHP SDK for integrating with the [Msgly API](https://msgly.id). Easily send WhatsApp OTP messages, single text messages, and manage templates in PHP 7.4+.

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

[](#requirements)

- PHP 7.4 or higher
- Composer
- `ext-json` extension

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

[](#installation)

Install via Composer:

```
composer require msgly/msgly-sdk-php
```

Quick Start
-----------

[](#quick-start)

### 1. Initialize Client

[](#1-initialize-client)

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

use Msgly\MsglyClient;
use Msgly\Exceptions\MsglyException;

$msgly = new MsglyClient([
    'base_url'      => 'https://api.msgly.id', // Optional, defaults to https://api.msgly.id
    'client_id'     => 'YOUR_CLIENT_ID',
    'client_secret' => 'YOUR_CLIENT_SECRET',
]);
```

### 2. Send OTP (Mode 1: OTP Rotation Aktif)

[](#2-send-otp-mode-1-otp-rotation-aktif)

Jika **OTP Rotation** diaktifkan di akun Anda oleh Admin, Anda tidak perlu menentukan `template_id`. Cukup kirim `code`, dan server Msgly akan secara otomatis merotasi template WhatsApp secara acak.

```
try {
    $result = $msgly->message()->sendOTP([
        'xid'  => uniqid('otp_'), // Required: Unique transaction ID
        'to'   => '6281234567890', // Required: Destination number (62...)
        'code' => '482910',        // OTP Code to substitute into template
    ]);

    print_r($result);
} catch (MsglyException $e) {
    echo "Error sending OTP (Rotation): " . $e->getMessage();
}
```

### 3. Send OTP (Mode 2: Manual Template Selection)

[](#3-send-otp-mode-2-manual-template-selection)

Jika **OTP Rotation TIDAK aktif**, Anda wajib menentukan `template_id` dan array `params` secara manual.

```
try {
    $result = $msgly->message()->sendOTP([
        'xid'      => uniqid('otp_'),
        'to'       => '6281234567890',
        'template' => [
            'template_id' => 'c8f7a1b2-3c4d-5e6f-7a8b-9c0d1e2f3a4b',
            'params'      => ['482910'],
        ],
    ]);

    print_r($result);
} catch (MsglyException $e) {
    echo "Error sending OTP (Manual): " . $e->getMessage();
}
```

### 4. Manage Templates (List &amp; Get Detail)

[](#4-manage-templates-list--get-detail)

```
try {
    // List templates (supports 'page', 'per_page', 'search')
    $templates = $msgly->template()->list(['search' => 'OTP', 'page' => 1, 'per_page' => 10]);
    print_r($templates);

    // Get specific template detail by ID
    if (!empty($templates['data']['data'])) {
        $templateId = $templates['data']['data'][0]['id'];
        $detail = $msgly->template()->getById($templateId);
        print_r($detail);
    }
} catch (MsglyException $e) {
    echo "Error fetching templates: " . $e->getMessage();
}
```

License
-------

[](#license)

MIT License

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance100

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity33

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/977971c0cb9c4780353d8a3b0bae30ba0ae3c81875589d12fb4742e8c80ce1b7?d=identicon)[adjinovandhi](/maintainers/adjinovandhi)

---

Top Contributors

[![adji87](https://avatars.githubusercontent.com/u/216133483?v=4)](https://github.com/adji87 "adji87 (2 commits)")

### Embed Badge

![Health badge](/badges/msgly-official-msgly-sdk-php/health.svg)

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

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k555.0M2.8k](/packages/aws-aws-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k832.6k51](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.3M49](/packages/tencentcloud-tencentcloud-sdk-php)[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k19](/packages/tempest-framework)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

293.1k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2482.9k](/packages/filescom-files-php-sdk)

PHPackages © 2026

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