PHPackages                             timerlau/aliyun-dysms-php-sdk - 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. timerlau/aliyun-dysms-php-sdk

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

timerlau/aliyun-dysms-php-sdk
=============================

阿里短信服务SDK For Laravel

v2.1.2(8y ago)3103MITPHPPHP &gt;=5.5.0

Since Mar 5Pushed 8y ago1 watchersCompare

[ Source](https://github.com/timerlau/aliyun-dysms-php-sdk)[ Packagist](https://packagist.org/packages/timerlau/aliyun-dysms-php-sdk)[ Docs](https://github.com/timerlau/aliyun-dysms-php-sdk.git)[ RSS](/packages/timerlau-aliyun-dysms-php-sdk/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (1)Versions (9)Used By (0)

AliyunSms
=========

[](#aliyunsms)

阿里云短信服务SDK封装 for Laravel

系统要求
====

[](#系统要求)

```
php >= 5.5
laravel >= 5.4
guzzlehttp/guzzle >= 6.0

```

说明
==

[](#说明)

- 没有对阿里云的SDK做任何修改！可以放心使用！
- master分支修复了阿里云SDK的一个[BUG](https://github.com/timerlau/aliyun-dysms-php-sdk/commit/0b37c4a93b8bfc4ae59f678be6bc68da0e905c48)
- nofix分支保持阿里云SDK原样
- 集成了 api\_sdk，msg\_sdk。不过根据实际使用情况来说，建议设置callback地址更为方便。msg\_sdk的队列消息处理不当会很乱。

安装
==

[](#安装)

```
composer require timerlau/aliyun-dysms-php-sdk

```

配置文件
====

[](#配置文件)

```

修改 config/app.php 如下：
1. providers 增加 Timerlau\AliyunSms\AliyunSmsServiceProvider::class,
2. aliases   增加 'Sms' => Timerlau\AliyunSms\Facades\Sms::class,

php artisan vendor:publish --provider="Timerlau\AliyunSms\AliyunSmsServiceProvider"

修改 config/sms.php

// 阿里云 KEY & SECRET
'ACCESS_KEY_ID'=>env('SMS_ACCESS_KEY_ID'),
'ACCESS_KEY_SECRET'=>env('SMS_ACCESS_KEY_SECRET'),

// 默认短信签名
'default_sign_name'=>env('SMS_DEFAULT_SIGN_NAME'),

// 默认短信模板编号
'default_template_code'=>env('SMS_DEFAULT_TEMPLATE_CODE'),

```

使用
==

[](#使用)

```
use Sms;

// 默认的发送
$state = Sms::phone('手机号')->assign(['code'=>'123456'])->send();

// 设置手机号，赋值变量，选择模板等操作
$sms = Sms::phone($mobile);
$state = $sms->outId($outid)->assign(['code'=>$code])->send();

if (!$state) {
    dd($sms->getException());
} else {
    echo '发送成功 ';
    dd('发送回执号: ' . $sms->bizId);
    dd('hello, sms');
}

// 短信发送状态 bizid可选
$sms = Sms::phone($mobile);
$response = $sms->bizId($biz_id)->history();

// 使用MNS消息队列，查询手机接收状况 （消息队列不太好，建议使用 HTTP批量推送模式）
// 需要开启MNS

// 发送短信
$sms = Sms::phone($mobile);
$state = $sms->outId($outid)->assign(['code'=>$code])->send();

if (!$state) {
    dd($sms->getException());
} else {
    echo '发送成功 ' . $mobile . '  ';
    echo '发送回执号: ' . $sms->bizId . '';

    $bool = $sms->receive(function ($message) {
        dump($message);
        return true;
    });

    if ($bool !== True) {
        dump($bool);
        dd('获取短信状态异常');
    }
    dump('hello, sms');
    dd($bool);
}

// 批量发送短信
$phone = ['176xxx','186xxx','187xxx'];
$sign = ['签名1', '签名1', '签名1'];
$template = 'SMS_xxx';

$assign = [];
foreach ($phone as $mobile) {
    $assign[]['code'] = mt_rand(1000, 9999);
}

$sms = Sms::phone($phone)->sign($sign)->template($template)->assign($assign);
dd($sms->multiSend());

```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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

Total

7

Last Release

3005d ago

Major Versions

v1.0.2 → v2.0.12018-03-07

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5009787?v=4)[afart](/maintainers/timerlau)[@timerlau](https://github.com/timerlau)

---

Top Contributors

[![timerlau](https://avatars.githubusercontent.com/u/5009787?v=4)](https://github.com/timerlau "timerlau (1 commits)")

---

Tags

laravelsdkaliyun dysms php sdk

### Embed Badge

![Health badge](/badges/timerlau-aliyun-dysms-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/timerlau-aliyun-dysms-php-sdk/health.svg)](https://phpackages.com/packages/timerlau-aliyun-dysms-php-sdk)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k532.1M2.5k](/packages/aws-aws-sdk-php)[venturedrake/laravel-crm

A free open source CRM built as a package for laravel projects

42010.0k](/packages/venturedrake-laravel-crm)[firefly-iii/data-importer

Firefly III Data Import Tool.

8005.8k](/packages/firefly-iii-data-importer)[nickurt/laravel-akismet

Akismet for Laravel 11.x/12.x/13.x

98145.2k3](/packages/nickurt-laravel-akismet)

PHPackages © 2026

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