PHPackages                             mindertech/laravel-aliyun-dysms - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. mindertech/laravel-aliyun-dysms

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

mindertech/laravel-aliyun-dysms
===============================

Aliyun SMS PHP SDK for Laravel

1.0.1(4y ago)0370MITPHPPHP &gt;=7.1.13

Since Jun 25Pushed 4y ago1 watchersCompare

[ Source](https://github.com/mindertech/laravel-aliyun-dysms)[ Packagist](https://packagist.org/packages/mindertech/laravel-aliyun-dysms)[ Docs](https://github.com/mindertech/laravel-aliyun-dysms)[ RSS](/packages/mindertech-laravel-aliyun-dysms/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (2)Versions (2)Used By (0)

Installation
------------

[](#installation)

1. add the following to your composer.json. Then run `composer update`:

    ```
    "pgroot/laravel-aliyun-dysms": "dev-master"
    ```

    or

    ```
    composer require pgroot/laravel-aliyun-dysms
    ```
2. Run the command below to publish the package config file `config/dysms.php`:

    ```
    php artisan vendor:publish --provider=Mindertech\Dysms\MindertechDysmsServiceProvider
    ```

Configuration
-------------

[](#configuration)

Set the property values in the `config/dysms.php`.

default

```
return [
    'access_key_id' => '',
    'access_key_secret' => '',
    'sign' => '',
    'log' => false,
    'sms-report-queue' => '',
    'sms-up-queue' => '',

    //以下配置暂时无需替换
    'product' => 'Dysmsapi',
    'domain' => 'dysmsapi.aliyuncs.com',
    'region' => 'cn-hangzhou',
    'end_point_name' => 'cn-hangzhou',
    'mns' => [
        'account_id' => '1943695596114318',
        'product' => 'Dybaseapi',
        'domain' => 'dybaseapi.aliyuncs.com',
        'wait_seconds' => 3
    ],
];
```

Usage
-----

[](#usage)

1. send sms

    ```
    try {
        $bizId = SendSms::to('SMS_123456', '18688886666', [
            'code' => mt_rand(1000, 9999)
        ]);
    } catch(\Exception $e) {
        echo $e->getMessage();
    }
    ```
2. query sms

    ```
    $page = 1;
    $pageSize = 1;
    $bizId = null;
    $result = QuerySms::search('18688886666', '20180516', $page, $pageSize, $bizId);
    ```

    response

    ```
    {
        "page": 1,
        "pageSize": 1,
        "sendDate": "20180516",
        "result": [{
            "SendDate": "2018-05-16 16:04:53",
            "SendStatus": 3,
            "ReceiveDate": "2018-05-16 16:04:57",
            "ErrCode": "0",
            "TemplateCode": "SMS_123456",
            "Content": "",
            "PhoneNum": "18688886666"
        }],
        "total": 7
    }
    ```
3. send batch sms

    ```
        try {
            $bizId = SendSmsBatch::to(
                        'SMS_123456',
                        [
                            '18688886666',
                            '18666666666'
                        ],
                        [
                            'sign-1', 'sign-2'
                        ],
                        [
                            [
                                'code' => mt_rand(1000, 9999)
                            ],
                            [
                                'code' => mt_rand(1000, 9999)
                            ]
                        ]
                    );
        } catch (\Exception $e) {
            echo $e->getMessage();
        }
    ```
4. MNS

    see: [https://help.aliyun.com/document\_detail/55500.html](https://help.aliyun.com/document_detail/55500.html)

    ```
    /**
     * 回调
     * @param stdClass $message 消息数据
     * @return bool 返回true，则工具类自动删除已拉取的消息。返回false，消息不删除可以下次获取
     */
    SmsQueue::up(function($message) {

        /*
        {
          "dest_code": "2199787"
          "send_time": "2018-05-16 18:05:13"
          "sign_name": "signname"
          "sp_id": null
          "sequence_id": 531571249
          "phone_number": "18688886666"
          "content": "回复测试"
        }
        */
        print_r($message);

        return true;
    });
    ```

    ```
    /**
     * 回调
     * @param stdClass $message 消息数据
     * @return bool 返回true，则工具类自动删除已拉取的消息。返回false，消息不删除可以下次获取
     */
    SmsQueue::report(function($message) {

        /*
        {
          "send_time": "2018-05-16 14:18:57"
          "report_time": "2018-05-16 14:19:02"
          "success": true
          "err_msg": "用户接收成功"
          "err_code": "DELIVERED"
          "phone_number": "18688886666"
          "sms_size": "1"
          "biz_id": "48490846451537371^0"
          "out_id": null
        }
        */
        print_r($message);

        return true;
    });
    ```
5. set config at runtime

    ```
        try {
            $bizId = SendSms::setRuntimeConfig([
                'access_key_id' => 'id',
                'access_key_secret' => 'key'
            ])->to('SMS_123456', '18688886666', [
                'code' => mt_rand(1000, 9999)
            ]);
        } catch(\Exception $e) {
            echo $e->getMessage();
        }
    ```

Todo
----

[](#todo)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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

Unknown

Total

1

Last Release

1782d ago

### Community

Maintainers

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

---

Top Contributors

[![alex-liu-mindertech](https://avatars.githubusercontent.com/u/59003648?v=4)](https://github.com/alex-liu-mindertech "alex-liu-mindertech (1 commits)")

---

Tags

laravelsdksmsaliyun

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mindertech-laravel-aliyun-dysms/health.svg)

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

###  Alternatives

[jjonline/aliyun-dysms-php-sdk

Aliyun SMS SDK for PHP

2197.2k](/packages/jjonline-aliyun-dysms-php-sdk)[curder/laravel-aliyun-sms

阿里云短信服务 - Laravel

113.6k](/packages/curder-laravel-aliyun-sms)

PHPackages © 2026

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