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

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

jundayw/laravel-sms
===================

laravel sms

v2.0.0(2y ago)026MITPHPPHP &gt;=8.0

Since Apr 10Pushed 2y ago1 watchersCompare

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

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

安装方法
====

[](#安装方法)

命令行下, 执行 composer 命令安装:

```
composer require jundayw/laravel-sms

```

对象方法
====

[](#对象方法)

短信服务商
-----

[](#短信服务商)

public function via(string $via): SMSAdapterContract;

```
$this->via('aliyun');
```

短信发送对象
------

[](#短信发送对象)

public function to(mixed $recipients): static;

```
$this->to('13600000000');
$this->to('13600000000,13600000001');
$this->to(['13600000000','13600000001']);
```

短信名称及短信参数
---------

[](#短信名称及短信参数)

public function scene(string $templateName, array $templateParam = \[\]): static;

```
$this->scene('code');
$this->scene('code',['code' => 123456]);
```

发送短信
----

[](#发送短信)

public function send(array $options = \[\]): SMSResponseContract;

```
$this->send();
```

短信验证
----

[](#短信验证)

public function check(mixed $input): bool;

```
$this->to('13600000000')->scene('code')->check('123456');
```

使用场景
====

[](#使用场景)

发布配置文件
------

[](#发布配置文件)

```
php artisan vendor:publish --tag=laravel-sms-config
```

配置文件
----

[](#配置文件)

```
return [
    'default' => 'aliyun',
    'cache' => null,
    'aliyun' => [
        'access_key_id' => env('ALIYUN_ACCESS_KEY_ID', ''),
        'access_key_secret' => env('ALIYUN_ACCESS_KEY_SECRET', ''),
        'sign_name' => '阿里云',
        'scenes' => [
            'code' => [
                'template_code' => 'SMS_35650882',
                'template_text' => '您的验证码为：${code}，请勿泄露于他人，本验证码有效期 5 分钟！',
                'sign_name' => '阿里云',
                'hooks' => [
                    new \Jundayw\SMS\Hooks\Expire('code', null, 5),
                ],
            ],
            'password' => [
                'template_code' => 'SMS_35650882',
                'template_text' => '您的验证码为：${code}，请勿泄露于他人，本验证码有效期 ${minute} 分钟！',
                'hooks' => [
                    new \Jundayw\SMS\Hooks\Expire('code', 'minute', 5),
                ],
            ],
            'notice' => [
                'template_code' => 'SMS_35650881',
                'template_text' => '体验卡权益已生效，券后立减 ${code} 元！',
            ],
        ],
        'options' => [
            'region_id' => 'cn-hangzhou',
        ],
        'driver' => \Jundayw\SMS\Adapters\AliSMSAdapter::class,
    ],
    'qcloud' => [
        'secret_id' => env('TENCENTCLOUD_SECRET_ID', ''),
        'secret_key' => env('TENCENTCLOUD_SECRET_KEY', ''),
        'sms_sdk_app_id' => env('TENCENTCLOUD_SMS_SDK_APP_ID', ''),
        'sign_name' => '腾讯云',
        'scenes' => [
            'code' => [
                'template_id' => '449739',
                'template_text' => '您的验证码为：{1}，请勿泄露于他人，本验证码有效期 5 分钟！！',
                'sign_name' => '腾讯云',
                'hooks' => [
                    new \Jundayw\SMS\Hooks\Expire(1, null, 5),
                ],
            ],
            'password' => [
                'template_id' => '449739',
                'template_text' => '您的验证码为：{1}，请勿泄露于他人，本验证码有效期 {2} 分钟！！',
                'hooks' => [
                    new \Jundayw\SMS\Hooks\Expire(1, 2, 5),
                ],
            ],
            'notice' => [
                'template_id' => '449738',
                'template_text' => '体验卡权益已生效，券后立减 {1} 元！',
            ],
        ],
        'options' => [
            'region' => 'ap-guangzhou',
        ],
        'driver' => \Jundayw\SMS\Adapters\QCloudSMSAdapter::class,
    ],
];
```

```
SMS::via('aliyun')->to('13600000000,13600000001')->scene('code', ['code' => 123456])->send();
SMS::via('aliyun')->to('13600000000')->scene('code')->check('123456');

SMS::via('aliyun')->to('13600000001')->scene('password', ['code' => 123456, 'minute' => 15])->send();
sms()->via('aliyun')->to(['13600000001'])->scene('password')->check(123456);

SMS::via('qcloud')->to(['13600000000','13600000001'])->scene('code', ['code' => 123456])->send();
SMS::via('qcloud')->to(['13600000001'])->scene('code')->check(123456);

SMS::via('qcloud')->to('13627685922')->scene('password', ['code' => 123456, 'minute' => 15])->send();
sms()->via('qcloud')->to('13600000001')->scene('password')->check(123456);
```

```
SMS::to('13600000000,13600000001')->scene('code', ['code' => 123456])->send();
SMS::via('qcloud')->to(['13600000000','13600000001'])->scene('code', ['code' => 123456])->send();

sms()->to(['13600000001'])->scene('password')->check(123456);
sms()->via('qcloud')->to('13600000001')->scene('password')->check(123456);
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Total

3

Last Release

1091d ago

Major Versions

v1.1.0 → v2.0.02023-05-18

PHP version history (2 changes)v1.0.0PHP &gt;=7.2.0

v1.1.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/2da9b458375a1b7972b7c4d26a5bf8f3e48db305e8805da36f253956f33c5568?d=identicon)[jundayw](/maintainers/jundayw)

---

Top Contributors

[![jundayw](https://avatars.githubusercontent.com/u/16873970?v=4)](https://github.com/jundayw "jundayw (16 commits)")

---

Tags

aliyunqcloudsms

### Embed Badge

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

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

PHPackages © 2026

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