PHPackages                             hyancat/short-messenger - 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. hyancat/short-messenger

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

hyancat/short-messenger
=======================

PHP 短信信使，支持阿里云短信和 SendCloud 短信。

v1.0(9y ago)2404[4 issues](https://github.com/HyanCat/short-messenger/issues)MITPHPPHP &gt;=5.6

Since Mar 22Pushed 9y ago1 watchersCompare

[ Source](https://github.com/HyanCat/short-messenger)[ Packagist](https://packagist.org/packages/hyancat/short-messenger)[ RSS](/packages/hyancat-short-messenger/feed)WikiDiscussions master Synced yesterday

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

short-messenger
===============

[](#short-messenger)

PHP 短信组件包，支持阿里云短信和 SendCloud 短信。

[![PHP](https://camo.githubusercontent.com/de76e4831087891136d47770baf6958de29edecbd632ab5f1fa777c2803845d5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d352e36253243372e30253243372e312d626c75652e737667)](https://camo.githubusercontent.com/de76e4831087891136d47770baf6958de29edecbd632ab5f1fa777c2803845d5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d352e36253243372e30253243372e312d626c75652e737667)[![license](https://camo.githubusercontent.com/850eae1099d2b05f53383473d7cd51f9bc1ab09b7d0d9e5122f1dd930efdcc6d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6173686170652f6170697374617475732e737667)](https://camo.githubusercontent.com/850eae1099d2b05f53383473d7cd51f9bc1ab09b7d0d9e5122f1dd930efdcc6d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6173686170652f6170697374617475732e737667)[![Build Status](https://camo.githubusercontent.com/729ceebcfedb8ca4e4d0f5c58704057823ad314a853849522032e5bc3baa29c3/68747470733a2f2f7472617669732d63692e6f72672f4879616e4361742f73686f72742d6d657373656e6765722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/HyanCat/short-messenger)

Requirements
------------

[](#requirements)

`short-messenger` 依赖于以下工具包或环境

- PHP: &gt;= 5.6
- composer

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

[](#installation)

使用 composer 安装依赖包

```
composer require hyancat/short-messenger

```

Usage
-----

[](#usage)

### Generally

[](#generally)

1. 配置

    ```
    $config = [
        'default' => 'aliyun',

        'providers' => [
            'aliyun'    => [
                'region'     => 'cn-hangzhou',
                'access_id'  => 'xxx',
                'access_key' => 'yyy',
            ],
            'sendcloud' => [
                'sms_user' => 'xxx',
                'sms_key'  => 'yyy',
            ],
        ],
    ];
    ```
2. 代码示例

    ```
    // 配置驱动
    $manager = new SmsManager();
    $manager->config($config);
    $manager->extend('aliyun', function () use ($config) {
        return new AliyunProvider($config['providers']['aliyun']);
    });
    $manager->extend('sendcloud', function () use ($config) {
        return new SendCloudProvider($config['providers']['sendcloud']);
    });
    // 创建 Service
    $smsService = new SmsService($manager);
    $smsService->send('186xxx', function (ShortMessage $message) {
        $message->template('template_123')
                ->signature('SIGNATURE_xx')
                ->data(['code' => 1234]);
    });
    ```

### Laravel or Lumen

[](#laravel-or-lumen)

1. 添加 ServiceProvider

    ```
    HyanCat\ShortMessenger\SmsServiceProvider::class
    ```
2. 配置 sms.php

    ```
    [
        'default' => 'aliyun',

        'providers' => [

            'aliyun' => [
                'region'     => 'cn-hangzhou',
                'access_id'  => env('ALIYUN_SMS_ACCESS_ID', ''),
                'access_key' => env('ALIYUN_SMS_ACCESS_KEY', ''),
            ],

            'sendcloud' => [
                'sms_user' => env('SENDCLOUD_SMS_USER', ''),
                'sms_key'  => env('SENDCLOUD_SMS_KEY', ''),
            ],
        ]
    ]
    ```

    在 Laravel 框架下可以使用 artisan 命令创建：

    ```
     php artisan vendor:publish --provider=HyanCat\ShortMessenger\SmsServiceProvider

    ```
3. 代码示例

    ```
    use HyanCat\ShortMessenger\SmsServiceFacade as SMS;

    SMS::send('18688888888', function (ShortMessage $message) {
        $message->template('template_123')
                ->signature('SIGNATURE_xx')
                ->data(['code' => 1234]);
    });
    ```

License
-------

[](#license)

```
The MIT License (MIT)

Copyright (c) 2017 HyanCat

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity58

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

3388d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3190081?v=4)[流光不加少](/maintainers/HyanCat)[@HyanCat](https://github.com/HyanCat)

---

Tags

composerlaravellumenmessagepackagistphpshort

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hyancat-short-messenger/health.svg)

```
[![Health](https://phpackages.com/badges/hyancat-short-messenger/health.svg)](https://phpackages.com/packages/hyancat-short-messenger)
```

###  Alternatives

[mattketmo/email-checker

Throwaway email detection library

2742.1M5](/packages/mattketmo-email-checker)[sarfraznawaz2005/noty

Laravel package to incorporate noty flash notifications into laravel.

324.5k](/packages/sarfraznawaz2005-noty)

PHPackages © 2026

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