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

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

namesfang/aliyun-sms
====================

阿里云短信

1.0.0(5y ago)028MITPHP &gt;=7.2

Since Jan 27Compare

[ Source](https://github.com/namesfang/aliyun-sms)[ Packagist](https://packagist.org/packages/namesfang/aliyun-sms)[ Docs](https://github.com/namesfang/aliyun-sms)[ RSS](/packages/namesfang-aliyun-sms/feed)WikiDiscussions Synced 1w ago

READMEChangelogDependenciesVersions (2)Used By (0)

### 阿里云短信服务

[](#阿里云短信服务)

##### 发送短信 示例

[](#发送短信-示例)

```
use Namesfang\Aliyun\Sms\Log\Logger;
use Namesfang\Aliyun\Sms\Bundle\Send;
use Namesfang\Aliyun\Sms\Bundle\SendOption;

// +-----------------------------------------------------------
// | 第1种 配置参数方式
// | 直接在实例化时传入一个关联数组(非接口参数会自动过滤)
// | 每个 key 对应接口中的参数
// | 当值为数组时自动转义为json字符串
// +-----------------------------------------------------------
$option = new SendOption('AccessKeySecret', [
    'AsscessKeyId'=> 'AsscessKeyId',
    'SignName'=> '签名',
    'PhoneNumbers'=> '15212341234',
    'TemplateCode'=> 'SMS_2050000388',
    'TemplateParam'=> '{"code":"232322"}',
]);

// +-----------------------------------------------------------
// | 第2种 配置参数方式
// | 调用相应的设置函数分别设置
// | 当值为数组时自动转义为json字符串
// +-----------------------------------------------------------
$option = new SendOption('AccessKeySecret');
$option->setAsscessKeyId('AsscessKeyId');
$option->setSignName('签名');
$option->setPhoneNumbers('15212341234');
$option->setTemplateCode('SMS_2050000388');
$option->setTemplateParam([
    'code'=> '123456',
]);

// 也可以自行封装日志实现 LoggerInterface 即可
$logger = new Logger(LOG_PATH, true);
// 实例化发送类
$send = new Send($option, $logger);

// 发送
$res = $send->request();

// 判断请求是否异常
if($res->error) {
    $logger->print($res->error, true);
}

// 打印接口返回的原始数据
// $logger->print($res->original, true);

// 打印接口返回状态
$logger->print($res->Code, true);

// 打印接口返回信息
$logger->print($res->result, true);

```

##### 批量发送短信 示例

[](#批量发送短信-示例)

```
use Namesfang\Aliyun\Sms\Log\Logger;
use Namesfang\Aliyun\Sms\Bundle\SendBatch;
use Namesfang\Aliyun\Sms\Bundle\SendBatchOption;

// +-----------------------------------------------------------
// | 第1种 配置参数方式
// | 直接在实例化时传入一个关联数组(非接口参数会自动过滤)
// | 每个 key 对应接口中的参数
// | 当值为数组时自动转义为json字符串
// +-----------------------------------------------------------
$option = new SendBatchOption('', [
    'AsscessKeyId'=> 'AsscessKeyId',
    'PhoneNumberJson'=> '["15212341234", "15312341234"]',
    'SignNameJson'=> '["签名一", "签名二"]',
    'TemplateCode'=> 'SMS_22222222',
    'TemplateParamJson'=> '[["param1"=> "123456"], ["param1"=> "123121"]]',
]);

// +-----------------------------------------------------------
// | 第2种 配置参数方式
// | 调用相应的设置函数分别设置
// | 当值为数组时自动转义为json字符串
// +-----------------------------------------------------------
$option = new SendBatchOption('');
$option->setAsscessKeyId('AsscessKeyId');
$option->setPhoneNumberJson(['15212341234', '15312341234']);
$option->setSignNameJson(['签名一', '签名一']);
$option->setTemplateCode('SMS_22222222');
$option->setTemplateParamJson([
    ['code'=> '123456'],
    ['code'=> '098781'],
]);

// 也可以自行封装日志
// 实现 LoggerInterface
$logger = new Logger(LOG_PATH, true);

$send = new SendBatch($option, $logger);

// 发送
$res = $send->request();

// 判断请求是否异常
if($res->error) {
    $logger->print($res->error, true);
}

// 打印接口返回的原始数据
// $logger->print($res->original, true);

// 打印接口返回状态 使用 __get 实现从 result中获取
$logger->print($res->Code, true);

// 打印接口返回信息
$logger->print($res->result, true);

```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

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

2027d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5258216?v=4)[堪笑](/maintainers/namesfang)[@namesfang](https://github.com/namesfang)

---

Tags

sms

### Embed Badge

![Health badge](/badges/namesfang-aliyun-sms/health.svg)

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

###  Alternatives

[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2588.7M19](/packages/laravel-notification-channels-twilio)[mageplaza/module-smtp

SMTP Extension for Magento 2 helps the owner of store simply install SMTP (Simple Mail Transfer Protocol) server which transmits the messages into codes or numbers

3026.3M9](/packages/mageplaza-module-smtp)[tzsk/sms

A robust and unified SMS gateway integration package for Laravel, supporting multiple providers.

319280.7k6](/packages/tzsk-sms)[symfony/fake-sms-notifier

Fake SMS (as email or log during development) Notifier Bridge.

27894.3k1](/packages/symfony-fake-sms-notifier)[cmdotcom/text-sdk-php

PHP SDK to send messages with CM.com

23763.9k4](/packages/cmdotcom-text-sdk-php)[symfony/twilio-notifier

Symfony Twilio Notifier Bridge

131.3M2](/packages/symfony-twilio-notifier)

PHPackages © 2026

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