PHPackages                             xkeyi/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. xkeyi/aliyun-sms

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

xkeyi/aliyun-sms
================

Aliyun SMS SDK

1.0.1(5y ago)1216[1 issues](https://github.com/xkeyi/aliyun-sms/issues)MITPHP

Since Dec 24Pushed 5y agoCompare

[ Source](https://github.com/xkeyi/aliyun-sms)[ Packagist](https://packagist.org/packages/xkeyi/aliyun-sms)[ RSS](/packages/xkeyi-aliyun-sms/feed)WikiDiscussions master Synced today

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

 Aliyun-SMS
===========

[](#-aliyun-sms)

基于 [阿里云短信服务](https://help.aliyun.com/document_detail/55451.html?spm=a2c4g.11186623.6.573.58e83a76BkPkop) 的 PHP 组件

### 安装

[](#安装)

```
$ composer require xkeyi/aliyun-sms
```

### 配置

[](#配置)

在使用本扩展之前，你需要去 注册账号，然后开通短信服务，创建 AccessKey，并设置好自己的短信签名和短信模版。

### 使用

[](#使用)

```
use Xkeyi\AliyunSms\SendSms;

$config = [
    'access_key_id' => 'xxxxx',
    'access_key_secret' => 'xxxxx',
    'sign_name' => 'xxxxx', // 短信签名

];

$sms = new SendSms($config);

$result = $sms->send('18000000000', 'SMS_152549473', ['code' => '321475', 'name' => 'xxxx']);
```

### 参数说明

[](#参数说明)

```
 array | string send(string $phone, string $template_code, array $message)

```

> - `$phone` - 接收短信的手机号码
> - `$template_code` - 短信模版
> - `$message` - 包含所有在短信模版中设置的变量的数组，如：\['code' =&gt; '123456, 'name' =&gt; 'xxx'\]

### 在 Laravel 中使用

[](#在-laravel-中使用)

在 Laravel 中使用也是同样的安装方式，配置写在 `config/services.php` 中：

```
    .
    .
    .
    'aliyun_sms' => [
        'access_key_id' => env('ALIYUN_SMS_ACCESS_KEY_ID'),
        'access_key_secret' => env('ALIYUN_SMS_ACCESS_KEY_SECRET'),
        'sign_name' => env('ALIYUN_SMS_SIGN_NAME'),
    ],
```

然后在 `.env` 中配置上面的三个值：

```
ALIYUN_SMS_ACCESS_KEY_ID=xxxxx
ALIYUN_SMS_ACCESS_KEY_SECRET=xxxxx
ALIYUN_SMS_SIGN_NAME=xxxx

```

可以用两种方法获取 `Xkeyi\AliyunSms\SendSms` 实例：

#### 方法参数注入

[](#方法参数注入)

```
public function send(SendSms $sms)
{
    $res = $sms->send('18000000000', 'SMS_152549473', ['code' => '321475', 'name' => 'xxxx']);
}
```

#### 服务器访问

[](#服务器访问)

```
public function send()
{
    $res = app('aliyun-sms')->send('18000000000', 'SMS_152549473', ['code' => '321475', 'name' => 'xxxx']);
}
```

### 参考

[](#参考)

- [阿里云短信服务](https://help.aliyun.com/document_detail/55451.html?spm=a2c4g.11186623.6.573.58e83a76BkPkop)
- [PHP 扩展包实战教程 - 从入门到发布](https://laravel-china.org/courses/creating-package)；
- [Easy SMS](https://github.com/overtrue/easy-sms)

### License

[](#license)

MIT

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity62

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

Total

2

Last Release

2189d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9b1960e2ad306a5ed02cc4396257733a1c7d9181f6192add11d6dc0b8953d1b4?d=identicon)[xkeyi](/maintainers/xkeyi)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[dhlparcel/magento2-plugin

DHL Parcel plugin for Magento 2

11180.5k2](/packages/dhlparcel-magento2-plugin)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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