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

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

goletter/hyperf-sms
===================

hyperf短信扩展包

v1.0.6(6mo ago)09MITPHPPHP &gt;=8.1

Since Oct 30Pushed 6mo agoCompare

[ Source](https://github.com/goletter/hyperf-sms)[ Packagist](https://packagist.org/packages/goletter/hyperf-sms)[ RSS](/packages/goletter-hyperf-sms/feed)WikiDiscussions main Synced 1mo ago

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

hyperf-sms
==========

[](#hyperf-sms)

[![Latest Stable Version](https://camo.githubusercontent.com/56d701ffb0aa9696e2fa4653f2753e0ab886de33d3e74b2b2a26f950bfcdc60d/68747470733a2f2f706f7365722e707567782e6f72672f676f6c65747465722f6879706572662d736d732f762f737461626c65)](https://packagist.org/packages/goletter/hyperf-sms)[![Total Downloads](https://camo.githubusercontent.com/12b9be2626e0303fb8e897883b1488646278a518177c1bb9c7dd1cc3d765560c/68747470733a2f2f706f7365722e707567782e6f72672f676f6c65747465722f6879706572662d736d732f646f776e6c6f616473)](https://packagist.org/packages/goletter/hyperf-sms)[![Latest Unstable Version](https://camo.githubusercontent.com/8e730b976417f7ccf096cb2f1aa7f1bc71abae883e71d7893e9a1027e3c3f8af/68747470733a2f2f706f7365722e707567782e6f72672f676f6c65747465722f6879706572662d736d732f762f756e737461626c65)](https://packagist.org/packages/goletter/hyperf-sms)[![License](https://camo.githubusercontent.com/67016d5b873d79b86ba55cf1edccf4ba916d2043ade51307cc74919ea9a349d7/68747470733a2f2f706f7365722e707567782e6f72672f676f6c65747465722f6879706572662d736d732f6c6963656e7365)](https://packagist.org/packages/goletter/hyperf-sms)

运行环境
----

[](#运行环境)

- php &gt;= 8.1
- composer
- hyperf &gt;= 3.1

安装
--

[](#安装)

```
composer require goletter/hyperf-sms
```

配置
--

[](#配置)

发布配置

```
php bin/hyperf.php vendor:publish goletter/hyperf-sms
```

配置文件

```
return [
    // 默认驱动
    'default' => 'aliyun',
    'driver'  => [
        'aliyun'     => [
            'name'   => '阿里云短信',
            'driver' => \Goletter\Sms\Driver\Aliyun::class,
            'config' => [
                'accessKeyId'     => '',
                'accessKeySecret' => '',
                'regionId'        => '',
                'signName'        => '',
            ]
        ],
        'qiniu'      => [
            // 驱动名称
            'name'   => '七牛云短信',
            'driver' => \Goletter\Sms\Driver\Qiniu::class,
            // 驱动初始化参数
            'config' => [
                'access_key' => '',
                'secret_key' => '',
            ]
        ],
        'smschinese' => [
            'name'   => '中国网建',
            'driver' => \Goletter\Sms\Driver\Smschinese::class,
            'config' => [
                'uid' => '',
                'key' => '',
            ]
        ],
    ]
];
```

使用
--

[](#使用)

### 发送短信

[](#发送短信)

- **写法一**

```
use function Goletter\Sms\sms;

sms()->send('18888888888', [
    'template' => 'xxx',
    'content' => '您的验证码是1234，该验证码1分钟内有效，请勿泄漏于他人！',
    'data' => [
        'code' => '1234'
    ]
]);
```

- **写法二**

```
use Goletter\Sms\Contract\SmsInterface;

$sms = di(SmsInterface::class);
$sms->send('18888888888', [
    'template' => 'xxx',
    'content' => '您的验证码是1234，该验证码1分钟内有效，请勿泄漏于他人！',
    'data' => [
        'code' => '1234'
    ]
]);
```

### 获取信息

[](#获取信息)

```
use function Goletter\Sms\sms;

sms()->getName();

sms()->getDriver();
```

### 自定义驱动

[](#自定义驱动)

```
$sms = \Goletter\Sms\Facade\Sms::driver('qiniu');
// 或
// $sms = \Webguosai\HyperfSms\Facade\Sms::make('qiniu');

$sms->send('18888888888', [
    'template' => 'xxx',
    'content' => '您的验证码是1234，该验证码1分钟内有效，请勿泄漏于他人！',
    'data' => [
        'code' => '1234'
    ]
]);
```

### 闭包发送

[](#闭包发送)

```
use function Goletter\Sms\sms;

sms()->send('18888888888', [
    'content'  => function($driver){
        if ($driver == 'aliyun') {
            return '云片专用验证码：1235';
        }
        return '您的验证码为: 6379';
    },
    'template' => function($driver){
        if ($driver == 'aliyun') {
            return '1888883905033940992';
        }
        return 'SMS_001';
    },
    'data' => function($driver){
        return [
            'code' => 6379
        ];
    }
]);
```

License
-------

[](#license)

MIT

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance66

Regular maintenance activity

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

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

Total

5

Last Release

200d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

phpsmshyperfhyperf-sms

### Embed Badge

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

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

###  Alternatives

[hyperf/nacos

Nacos SDK

22487.9k10](/packages/hyperf-nacos)[amirbagh75/smsir-php

Unofficial sms.ir PHP Package

181.2k](/packages/amirbagh75-smsir-php)

PHPackages © 2026

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