PHPackages                             phalapi/sms - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. phalapi/sms

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

phalapi/sms
===========

PhalApi 2.x 扩展类库 - 短信拓展

0379↓80%PHP

Since Dec 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/gongshunkai/phalapi-sms)[ Packagist](https://packagist.org/packages/phalapi/sms)[ RSS](/packages/phalapi-sms/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependenciesVersions (1)Used By (0)

短信扩展
====

[](#短信扩展)

安装和配置
-----

[](#安装和配置)

修改项目下的composer.json文件，并添加：

```
    "phalapi/sms":"dev-master"

```

在/path/to/phalapi/config/app.php文件中，配置：

```
    'SMSService' => array(
        'accountSid'   => '',  //主帐号
        'accountToken' => '',  //主帐号Token
        'appId'        => '',  //应用Id
        'serverPort'   => '',  //请求端口 默认:8883
        'serverIP'     => ''   //请求地址不需要写https:// 默认:sandboxapp.cloopen.com
    )

```

然后执行`composer update`。

注册
--

[](#注册)

在/path/to/phalapi/config/di.php文件中，注册：

```
//初始化SMS\Lite传入配置文件地址,第二个参数为是否开启debug模式开启debug模式(默认false)会把返回结果打印出来(生产环境请不要进行设置)
$di->sms = function() {
	return new \PhalApi\SMS\Lite();
};
```

使用
--

[](#使用)

1. 发送模板短信

```
\PhalApi\DI()->sms->sendTemplateSMS("手机号码", "内容数据", "模板Id");
```

2. 短信模板查询

```
\PhalApi\DI()->sms->QuerySMSTemplate("模板ID");
```

3. 语音验证码

```
\PhalApi\DI()->sms->voiceVerify("验证码内容", "循环播放次数", "接收号码", "显示的主叫号码", "营销外呼状态通知回调地址", '语言类型', '第三方私有数据');
```

4. 语音文件上传

```
\PhalApi\DI()->sms->MediaFileUpload("文件名", "文件二进制数据");
```

5. 话单下载 前一天的数据（从00:00 – 23:59）

```
\PhalApi\DI()->sms->billRecords("话单规则", "客户的查询条件");
```

6. IVR外呼

```
\PhalApi\DI()->sms->ivrDial("待呼叫号码", "用户数据", "是否录音");
```

7. 外呼通知

```
\PhalApi\DI()->sms->landingCall("被叫号码", "语音文件名称", "文本内容", "显示的主叫号码", "循环播放次数", "外呼通知状态通知回调地址", '用户私有数据', '最大通话时长', '发音速度', '音量', '音调', '背景音编号');
```

8. 主帐号信息查询

```
\PhalApi\DI()->sms->queryAccountInfo();
```

9. 呼叫状态查询

```
\PhalApi\DI()->sms->QueryCallState("callid", "查询结果通知的回调url地址");
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/35d70b1236f8f67d96ba3da4ba88889faf2837ff8f7ab62acc54fe6cb4992c87?d=identicon)[dogstarhuang](/maintainers/dogstarhuang)

---

Top Contributors

[![gongshunkai](https://avatars.githubusercontent.com/u/16865308?v=4)](https://github.com/gongshunkai "gongshunkai (5 commits)")

### Embed Badge

![Health badge](/badges/phalapi-sms/health.svg)

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

###  Alternatives

[markbaker/enumhelper

A small library that provides Helper Traits for PHP 8.1 Enums

2819.4k1](/packages/markbaker-enumhelper)[thunderer/numbase

Convert any number between arbitrary bases

242.3k](/packages/thunderer-numbase)[asgardcms/block

A module to create small blocks of content to display anywhere on the site.

126.0k](/packages/asgardcms-block)

PHPackages © 2026

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