PHPackages                             yiiviet/yii2-esms - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. yiiviet/yii2-esms

ActiveYii2-extension[HTTP &amp; Networking](/categories/http)

yiiviet/yii2-esms
=================

Extension hổ trợ tích hợp dịch vụ eSMS.

1.0.3(7y ago)29BSD-3-ClausePHP

Since May 29Pushed 7y ago1 watchersCompare

[ Source](https://github.com/yiiviet/yii2-esms)[ Packagist](https://packagist.org/packages/yiiviet/yii2-esms)[ RSS](/packages/yiiviet-yii2-esms/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

YII2 eSMS
=========

[](#yii2-esms)

**Yii2 Extension hổ trợ bạn tích hợp dịch vụ eSMS.**

[![Latest Stable Version](https://camo.githubusercontent.com/dda40502422fc2266e46573c8a9fb0646a853a1a617b59b7d2c915fbc9a0d362/68747470733a2f2f706f7365722e707567782e6f72672f796969766965742f796969322d65736d732f762f737461626c65)](https://packagist.org/packages/yiiviet/yii2-esms)[![Total Downloads](https://camo.githubusercontent.com/db76309e07ba7dfe41132e4bf3c8ef29702a48e0bf53a93c3c2825894e8e2f3f/68747470733a2f2f706f7365722e707567782e6f72672f796969766965742f796969322d65736d732f646f776e6c6f616473)](https://packagist.org/packages/yiiviet/yii2-esms)[![Build Status](https://camo.githubusercontent.com/00f39d0e0860083b13753c8f6da87b21f2d614b1d2d8322d1dd7ad6c102db34e/68747470733a2f2f7472617669732d63692e6f72672f796969766965742f796969322d65736d732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/yiiviet/yii2-esms)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/58554d3e8ee4cfe8c11fda3406205a4f79c87af5dc1971d6ef846aaf12cf4238/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f796969766965742f796969322d65736d732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/yiiviet/yii2-esms/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/c800539eec363af7acdaa3394a18bd8c2d0549ab86d5618266c29b8ecfe269db/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f796969766965742f796969322d65736d732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/yiiviet/yii2-esms/?branch=master)[![Yii2](https://camo.githubusercontent.com/d6b0929173e28cc627430d2519ca1853466a70f37395877eaf4820cb3e1e1909/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f77657265645f62792d5969695f4672616d65776f726b2d677265656e2e7376673f7374796c653d666c6174)](http://www.yiiframework.com/)

Nếu như bạn thường xuyên xây dựng hệ thống có liên quan đến `sms` hay `voice call` thì chắc hẳn [eSMS](http://esms.vn) là một đối tác không quá xa lạ với bạn, extension này sẽ giúp bạn tích hợp dịch vụ của `eSMS`vào hệ thống của bạn.

Yêu cầu
-------

[](#yêu-cầu)

- [PHP &gt;= 7.1](http://php.net)
- [vxm/yii2-gateway-clients &gt;= 2.0.0](https://github.com/vuongxuongminh/yii2-gateway-clients)

Cài đặt
-------

[](#cài-đặt)

Cài đặt thông qua `composer` nếu như đó là một khái niệm mới với bạn xin click vào [đây](http://getcomposer.org/download/) để tìm hiểu nó.

```
composer require "yiiviet/yii2-esms"
```

hoặc thêm

```
"yiiviet/yii2-esms": "*"
```

vào phần `require` trong file composer.json.

Thiết lập
---------

[](#thiết-lập)

Sau khi cài đặt hoàn tất bạn hãy vào thư mục `config` mở file `web.php` và thêm cấu hình sau vào `components`:

```
'components' => [
    'eSMS' => [
        'class' => 'yiiviet\esms\Gateway',
        'client' => [
            'apiKey' => 'API key ban dang ky tai eSMS (phan quan ly api)',
            'secretKey' => 'Secret key ban dang ky tai eSMS (phan quan ly api)'
        ]
    ]
]
```

Sau khi thiết lập xong ngay lập tức bạn đã có thể giao tiếp với `eSMS` thông qua cú pháp sau: `Yii::$app->eSMS`.

Sử dụng cơ bản
--------------

[](#sử-dụng-cơ-bản)

**1. Cách gửi tin nhắn:**

```
    $result = Yii::$app->eSMS->sendSMS([
        'Phone' => '0909113911',
        'Content' => 'Hi Mr.Minh'
    ]);

    if ($result->isOk) {
        Yii::info('Send sms to Mr.Minh success! SMSID: ' . $result->SMSID);
    } else {
        Yii::warning($result->message);
    }
```

**2. Cách gửi voice call (cuộc gọi thoại):**

```
    Yii::$app->eSMS->sendVoice([
        'Phone' => '0909113911',
        'ApiCode' => 'xxxxxxxxxxx', // Liên hệ kỹ thuật eSMS cấp
        'ApiPass' => 'xxxxxxxxxxx'
    ]);

    if ($result->isOk) {
        Yii::info('Send voice call to Mr.Minh success! SMSID: ' . $result->SMSID);
    } else {
        Yii::warning($result->message);
    }
```

**3. Cách kiểm tra số dư tài khoản:**

```
    $result = Yii::$app->eSMS->getBalance();

    if ($result->isOk) {
        Yii::info('Balance of account: ' . $result->Balance);
    } else {
        Yii::warning($result->message);
    }
```

**4. Cách kiểm tra trạng thái tin nhắn đã gửi:**

```
    $result = Yii::$app->eSMS->getSendStatus($SMSID);

    if ($result->isOk) {
        Yii::info('Sent: ' . $result->SentSuccess);
    } else {
        Yii::warning($result->message);
    }
```

- `$SMSID` có được trong kết quả gửi `sms` hoặc `voice call` vì thế sau khi gửi tin nhắn xong bạn nên lưu lại `$SMSID`.

**5. Cách kiểm tra trạng thái chi tiết tin nhắn đã gửi (hiển thị chi tiết từng số điện thoại):**

```
    $result = Yii::$app->eSMS->getReceiverStatus($SMSID);

    if ($result->isOk) {
        Yii::info('Sent: ' . var_export($result->ReceiverList, true));
    } else {
        Yii::warning($result->message);
    }
```

- `$SMSID` có được trong kết quả gửi `sms` hoặc `voice call` vì thế sau khi gửi tin nhắn xong bạn nên lưu lại `$SMSID`.

Sử dụng nâng cao
----------------

[](#sử-dụng-nâng-cao)

Nếu bạn muốn tìm hiểu sau hơn về các thành phần khi tạo lệnh gửi `sms` hoặc `voice call` hay các thành phần kết quả mà `eSMS` gửi về thì mời bạn kham khảo thêm tại tài liệu của `eSMS` tại [đây](https://account.esms.vn/TailieuAPI_V4_060215_Rest_Public.pdf). Tên các thành phần trong tài liệu eSMS đồng nhất với tên các thành phần (property, element key) của extension này.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity66

Established project with proven stability

 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 ~55 days

Total

4

Last Release

2740d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8901d64a1059726b851dbdd91463ad1d3169f9dba6a2dcff11d05f97d9bccaea?d=identicon)[vuongxuongminh](/maintainers/vuongxuongminh)

---

Top Contributors

[![vuongxuongminh](https://avatars.githubusercontent.com/u/38932626?v=4)](https://github.com/vuongxuongminh "vuongxuongminh (19 commits)")

---

Tags

esmsintegrationssms-apiyii2yii2-extensionyiivnyii2sms apiesmsvoice-api

### Embed Badge

![Health badge](/badges/yiiviet-yii2-esms/health.svg)

```
[![Health](https://phpackages.com/badges/yiiviet-yii2-esms/health.svg)](https://phpackages.com/packages/yiiviet-yii2-esms)
```

###  Alternatives

[linslin/yii2-curl

Easy and nice cURL extension with RESTful support for Yii2

1811.5M20](/packages/linslin-yii2-curl)[zhuravljov/yii2-rest

Yii2 REST Client

1186.2k](/packages/zhuravljov-yii2-rest)[tunecino/yii2-nested-rest

Adds nested resources routing support along with related actions and relationship handlers to the Yii RESTful API framework

4815.8k](/packages/tunecino-yii2-nested-rest)

PHPackages © 2026

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