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

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

muyi/aliyun-dysms-php-sdk
=========================

Aliyun SMS SDK for PHP

4541PHP

Since Oct 24Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Dcmuyi/aliyun-dysms-php-sdk)[ Packagist](https://packagist.org/packages/muyi/aliyun-dysms-php-sdk)[ RSS](/packages/muyi-aliyun-dysms-php-sdk/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

aliyun-dysms-php-sdk
====================

[](#aliyun-dysms-php-sdk)

阿里云-短信服务PHP版sdk,阿里大鱼被合并到阿里云原先的的SDK已无法使用,为方便管理特将阿里云下载的sdk做了处理，此库仅用于自己的项目

composer安装
----------

[](#composer安装)

`composer require muyi/aliyun-dysms-php-sdk dev-master`

composer安装后用法请参考根目录Demo.php文件，例：

```
/**
 * 构造器
 *
 * @param string $accessKeyId 必填，AccessKeyId
 * @param string $accessKeySecret 必填，AccessKeySecret
 */
public function __construct($accessKeyId, $accessKeySecret)
{

    // 短信API产品名
    $product = "Dysmsapi";

    // 短信API产品域名
    $domain = "dysmsapi.aliyuncs.com";

    // 暂时不支持多Region
    $region = "cn-hangzhou";

    // 服务结点
    $endPointName = "cn-hangzhou";

    // 初始化用户Profile实例
    $profile = DefaultProfile::getProfile($region, $accessKeyId, $accessKeySecret);

    // 增加服务结点
    DefaultProfile::addEndpoint($endPointName, $region, $product, $domain);

    // 初始化AcsClient用于发起请求
    $this->acsClient = new DefaultAcsClient($profile);
}

/**
 * 发送短信范例
 *
 * @param string $signName
 * 必填, 短信签名，应严格"签名名称"填写，参考：短信签名页
 *
 * @param string $templateCode
 * 必填, 短信模板Code，应严格按"模板CODE"填写, 参考：短信模板页
 * (e.g. SMS_0001)
 *
 * @param string $phoneNumbers 必填, 短信接收号码 (e.g. 12345678901)
 * @param array|null $templateParam
 * 选填, 假如模板中存在变量需要替换则为必填项 (e.g. Array("code"=>"12345", "product"=>"阿里通信"))
 *
 * @param string|null $outId [optional] 选填, 发送短信流水号 (e.g. 1234)
 * @return stdClass
 */
public function sendSms($signName, $templateCode, $phoneNumbers, $templateParam = null, $outId = null) {

    // 初始化SendSmsRequest实例用于设置发送短信的参数
    $request = new SendSmsRequest();

    // 必填，设置雉短信接收号码
    $request->setPhoneNumbers($phoneNumbers);

    // 必填，设置签名名称
    $request->setSignName($signName);

    // 必填，设置模板CODE
    $request->setTemplateCode($templateCode);

    // 可选，设置模板参数
    if($templateParam) {
        $request->setTemplateParam(json_encode($templateParam));
    }

    // 可选，设置流水号
    if($outId) {
        $request->setOutId($outId);
    }

    // 发起访问请求
    $acsResponse = $this->acsClient->getAcsResponse($request);

    // 打印请求结果
    // var_dump($acsResponse);

    return $acsResponse;

}

$demo = new Demo(
    "yourAccessKeyId",
    "yourAccessKeySecret"
);

echo "SmsDemo::sendSms\n";
$response = $demo->sendSms(
    "短信签名", // 短信签名
    "SMS_0000001", // 短信模板编号
    "12345678901", // 短信接收者
    Array(  // 短信模板中字段的值
        "code"=>"12345",
        "product"=>"dsd"
    ),
    "123"
);

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[tijsverkoyen/css-to-inline-styles

CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.

5.8k505.3M227](/packages/tijsverkoyen-css-to-inline-styles)[minishlink/web-push

Web Push library for PHP

1.9k12.0M53](/packages/minishlink-web-push)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[spatie/url-signer

Generate a url with an expiration date and signature to prevent unauthorized access

4422.3M16](/packages/spatie-url-signer)[mattketmo/email-checker

Throwaway email detection library

2742.0M5](/packages/mattketmo-email-checker)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)

PHPackages © 2026

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