PHPackages                             xiaosongshu/message - 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. xiaosongshu/message

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

xiaosongshu/message
===================

短信发送和邮件发送客户端

v1.1.3(1y ago)112MITPHPPHP &gt;=7.0

Since Aug 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/2723659854/SmsMessage)[ Packagist](https://packagist.org/packages/xiaosongshu/message)[ RSS](/packages/xiaosongshu-message/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (15)Used By (0)

### 短信和邮件发送

[](#短信和邮件发送)

#### 简介

[](#简介)

本扩展支持阿里云、腾讯云和顶想云短信发送，支持阿里云、腾讯云邮件发送。

#### 安装

[](#安装)

```
composer require xiaosongshu/message
```

#### 用法

[](#用法)

```
use Xiaosongshu\Message\AliEmail;
use Xiaosongshu\Message\TencentEmail;
use Xiaosongshu\Message\TencentSms;
use Xiaosongshu\Message\MessageClient;
use Xiaosongshu\Message\AliSms;

        /** 阿里云短信发送配置 */
        $configASMS=[
            'accessKeyId'=>'',
            'accessKeySecret'=>'',
            'signName'=>'',
            'sdkAppId'=>""
        ];
        $res=(new MessageClient($configASMS))->Asms->setTemplate("SMS_154950909")->setConTent(['code' => rand(100000,999999)])->sendTo(['xxx'])->send();
        $res = AliSms::config($configASMS)->setTemplate("SMS_154950909")->setConTent(['code' => rand(100000,999999)])->sendTo(['xxx'])->send();
        $res = MessageClient::Asms()->config($configASMS)->setTemplate("SMS_154950909")->setConTent(['code' => rand(100000,999999)])->sendTo(['xxxx'])->send();

        /** 阿里云邮件发送配置 */
        $configAEmail=[
            'accessKeyId'=>'',
            'accessKeySecret'=>'',
            'fromAddress'=>''
        ];
        $res = (new MessageClient($configAEmail))->Aemail->setTitle('标题')->setContent(['你好呀'])->sendTo(['xxx'])->send();
        $res = AliEmail::config($configAEmail)->setTitle('标题')->setContent(['你好呀'])->sendTo(['xxx'])->send();
        $res = MessageClient::Aemail()->config($configAEmail)->setTitle('标题')->setContent(['你好呀'])->sendTo(['xxx'])->send();

        /** 腾讯短信发送配置 */
        $config=[
            'accessKeyId'=>'',
            'accessKeySecret'=>'',
            'signName'=>"",
            'sdkAppId'=>""
        ];
        $res=(new MessageClient($config))->Tsms->setTemplate("1430565")->setConTent(['code' => rand(100000,999999)])->sendTo(['xxx'])->send();
        $res=TencentSms::config($config)->setTemplate("1430565")->setConTent(['code' => rand(100000,999999)])->sendTo(['xxx'])->send();
        $res=MessageClient::Tsms()->config($config)->setTemplate("1430565")->setConTent(['code' => rand(100000,999999)])->sendTo(['xxx'])->send();

        /** 腾讯邮件发送配置 */
        $config= [
            'accessKeyId'=>'',
            'accessKeySecret'=>'',
            'fromAddress'=>''
        ];
        $res=(new MessageClient($config))->Temail->setTemplate()->setTitle('恭喜发财')->setConTent(['username' => '牡丹花'])->sendTo(['xxx'])->send();
        $res = TencentEmail::config($config)->setTemplate()->setTitle('恭喜发财')->setConTent(['username' => '牡丹花'])->sendTo(['xxx'])->send();
        $res=MessageClient::Temail()->config($config)->setTemplate()->setTitle('恭喜发财')->setConTent(['username' => '躺不平，摆不烂'])->sendTo(['xxx'])->send();

        /** 顶想云配置 */
        $config=[
            'accessKeyId'=>"xxxx",
            'accessKeySecret'=>'',
            'signName'=>"xxxx",
            'sdkAppId'=>""
        ];

        MessageClient::ThinkSms()->config($config)->setTemplate("demoTemplateId")->sendTo(['phone1','phone2','phone3'])->setContent(['code'=>'5000'])->send();
        \Xiaosongshu\Message\ThinkSms::config($config)->setTemplate("demoTemplateId")->sendTo(['phone1','phone2','phone3'])->setContent(['code'=>'5000'])->send();

```

#### 对服务进行扩展

[](#对服务进行扩展)

```
        $config= [
            'accessKeyId'=>'',
            'accessKeySecret'=>'',
            'fromAddress'=>''
        ];
       /** 对服务进行扩展：只在程序当前生命周期内有效。 */
        $factory = new MessageClient();
        /** 注册其他的消息服务类 例如Email第三方发送邮件服务,当然Email必须继承接口 Xiaosongshu\Message\provider\MessageProviderInterface */
        $factory->bind('other',Email::class);
        /** 调用已注册的服务 */
        $factory->other->config($config)->setTemplate()->setTitle('测试')->setConTent(['content' => '对服务进行扩展呢'])->sendTo(['xxx@qq.com'])->send();

        /** 静态注册  */
        MessageClient::register('other',Email::class);
        /** 静态调用 */
        MessageClient::other()->config($config)->setTemplate()->setTitle('恭喜发财')->setConTent(['username' => '躺不平，摆不烂'])->sendTo([''])->send();
```

注册的扩展服务只在当前生命周期内有效。

##### 异常捕获

[](#异常捕获)

catch Xiaosongshu\\Message\\exception\\TencentMsgException

联系作者：

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance43

Moderate activity, may be stable

Popularity7

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

Every ~47 days

Recently: every ~152 days

Total

14

Last Release

452d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/17f593cfd6a2e0845ea319086175a4d2173229dd598bf9f67575911fb3497f2b?d=identicon)[2723659854](/maintainers/2723659854)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/xiaosongshu-message/health.svg)

```
[![Health](https://phpackages.com/badges/xiaosongshu-message/health.svg)](https://phpackages.com/packages/xiaosongshu-message)
```

###  Alternatives

[maize-tech/laravel-email-domain-rule

Laravel Email Domain Rule

612.0k](/packages/maize-tech-laravel-email-domain-rule)[sarfraznawaz2005/noty

Laravel package to incorporate noty flash notifications into laravel.

324.5k](/packages/sarfraznawaz2005-noty)[overtrue/laravel-qcloud-federation-token

QCloud COS FederationToken generator for Laravel.

179.5k](/packages/overtrue-laravel-qcloud-federation-token)

PHPackages © 2026

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