PHPackages                             mucts/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. mucts/sms

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

mucts/sms
=========

A SMS sending component to meet your multiple sending needs.

1.0.9(6y ago)04611MITPHPPHP ^7.1CI failing

Since May 6Pushed 6y agoCompare

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

READMEChangelogDependencies (4)Versions (4)Used By (1)

SMS
===

[](#sms)

> 一款满足你的多种发送需求的短信发送组件

[![Latest Stable Version](https://camo.githubusercontent.com/aa7ff8b046c7eeb8482591c659e6337861fbddcb07ab07d3677f38050bbfa105/68747470733a2f2f706f7365722e707567782e6f72672f6d756374732f736d732f762f737461626c652e737667)](https://packagist.org/packages/mucts/sms)[![Total Downloads](https://camo.githubusercontent.com/1ce6dbed57a8f731b20c8193ffe0e77664946c8e7c2fafc3ca8a01afaa04f6af/68747470733a2f2f706f7365722e707567782e6f72672f6d756374732f736d732f646f776e6c6f6164732e737667)](https://packagist.org/packages/mucts/sms)[![Latest Unstable Version](https://camo.githubusercontent.com/4bff4739b57bff026395b41995f866d742505c1282775ffec13b132a6f7d68c5/68747470733a2f2f706f7365722e707567782e6f72672f6d756374732f736d732f762f756e737461626c652e737667)](https://packagist.org/packages/mucts/sms)[![License](https://camo.githubusercontent.com/357d1698db007dec30f08869d6d51661b2ef7597ade57ca83c22603517d39c29/68747470733a2f2f706f7365722e707567782e6f72672f6d756374732f736d732f6c6963656e73652e737667)](https://packagist.org/packages/mucts/sms)

特点
--

[](#特点)

1. 支持目前市面多家服务商
2. 一套写法兼容所有平台
3. 简单配置即可灵活增减服务商
4. 内置多种服务商轮询策略、支持自定义轮询策略
5. 统一的返回值格式，便于日志与监控
6. 自动轮询选择可用的服务商
7. 更多等你去发现与改进...

平台支持
----

[](#平台支持)

- [阿里云](https://www.aliyun.com/)
- [云片](https://www.yunpian.com)
- [Submail](https://www.mysubmail.com)
- [螺丝帽](https://luosimao.com/)
- [容联云通讯](http://www.yuntongxun.com)
- [互亿无线](http://www.ihuyi.com)
- [聚合数据](https://www.juhe.cn)
- [SendCloud](http://www.sendcloud.net/)
- [百度云](https://cloud.baidu.com/)
- [华信短信平台](http://www.ipyy.com/)
- [253云通讯（创蓝）](https://www.253.com/)
- [融云](http://www.rongcloud.cn)
- [天毅无线](http://www.85hu.com/)
- [腾讯云 SMS](https://cloud.tencent.com/product/sms)
- [阿凡达数据](http://www.avatardata.cn/)
- [华为云](https://www.huaweicloud.com/product/msgsms.html)
- [网易云信](https://yunxin.163.com/sms)
- [云之讯](https://www.ucpaas.com/index.html)
- [凯信通](http://www.kingtto.cn/)
- [七牛云](https://www.qiniu.com/)
- [UE35.net](http://uesms.ue35.cn/)
- [Ucloud](https://www.ucloud.cn)

环境需求
----

[](#环境需求)

- PHP ^7.1

安装
--

[](#安装)

```
$ composer require mucts/sms
```

**For Laravel notification**

如果你喜欢使用 [Laravel Notification](https://laravel.com/docs/5.8/notifications), 可以考虑直接使用朋友封装的拓展包：

使用
--

[](#使用)

```
use MuCTS\SMS\SMS;

$config = [
    // HTTP 请求的超时时间（秒）
    'timeout' => 5.0,

    // 默认发送配置
    'default' => [
        // 网关调用策略，默认：顺序调用
        'strategy' => MuCTS\SMS\Strategies\Order::class,

        // 默认可用的发送网关
        'gateways' => [
            'yunpian', 'aliyun',
        ],
    ],
    // 可用的网关配置
    'gateways' => [
        'errorlog' => [
            'file' => '/tmp/easy-sms.log',
        ],
        'yunpian' => [
            'api_key' => '824f0ff2f71cab52936axxxxxxxxxx',
        ],
        'aliyun' => [
            'access_key_id' => '',
            'access_key_secret' => '',
            'sign_name' => '',
        ],
        //...
    ],
];

$sms = new SMS($config);

$sms->send(13188888888, [
    'content'  => '您的验证码为: 6379',
    'template' => 'SMS_001',
    'data' => [
        'code' => 6379
    ],
]);
```

短信内容
----

[](#短信内容)

由于使用多网关发送，所以一条短信要支持多平台发送，每家的发送方式不一样，但是我们抽象定义了以下公用属性：

- `content` 文字内容，使用在像云片类似的以文字内容发送的平台
- `template` 模板 ID，使用在以模板ID来发送短信的平台
- `data` 模板变量，使用在以模板ID来发送短信的平台

所以，在使用过程中你可以根据所要使用的平台定义发送的内容。

```
$sms->send(17508598888, [
    'content'  => '您的验证码为: 6379',
    'template' => 'SMS_001',
    'data' => [
        'code' => 6379
    ],
]);
```

你也可以使用闭包来返回对应的值：

```
$sms->send(17508598888, [
    'content'  => function($gateway){
        return '您的验证码为: 6379';
    },
    'template' => function($gateway){
        return 'SMS_001';
    },
    'data' => function($gateway){
        return [
            'code' => 6379
        ];
    },
]);
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

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

Total

3

Last Release

2197d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/102022?v=4)[Herry Leonard](/maintainers/herry)[@herry](https://github.com/herry)

---

Top Contributors

[![yuandeng](https://avatars.githubusercontent.com/u/69410645?v=4)](https://github.com/yuandeng "yuandeng (13 commits)")

---

Tags

smssms-apisms-phpsms-sdk

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[dhlparcel/magento2-plugin

DHL Parcel plugin for Magento 2

11180.5k2](/packages/dhlparcel-magento2-plugin)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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