PHPackages                             xin6841414/easy-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. xin6841414/easy-sms

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

xin6841414/easy-sms
===================

extend from overtrue/easy-sms, add chuanglanv2 support.

v2.1.2(1mo ago)07MITPHP

Since May 25Pushed 1mo agoCompare

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

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

EasySms for Laravel
===================

[](#easysms--for-laravel)

使用 [overtrue/easy-sms](https://github.com/overtrue/easy-sms) 的laravel扩展包 在此基础上增加了对253云通讯(创蓝)v2的支持(Chuanglanv2Gateway)，如无需使用创蓝v2，请使用 [overtrue/laravel-easy-sms](https://github.com/overtrue/laravel-easy-sms)

安装
--

[](#安装)

```
$ composer require xin6841414/easy-sms
```

配置
--

[](#配置)

1. 在 config/app.php 注册 ServiceProvider (Laravel 5.5 + 无需手动注册)：

    ```
    'providers' => [
        // ...
        Xin6841414\EasySms\EasySmsServiceProvider::class,
    ],
    ```
2. 创建配置文件：

    ```
    $ php artisan vendor:publish --provider="Xin6841414\EasySms\EasySmsServiceProvider"
    ```
3. 修改应用根目录下的 config/easysms.php 中对应的参数即可。

使用
--

[](#使用)

### 1. 在控制器中使用

[](#1-在控制器中使用)

```
namespace App\Http\Controllers;

use Xin6841414\EasySms\Traits\Sms;
    class TestController extends Controller
{
    use Sms;
     public function index()
     {
       $mobile = '177xxx1234';
       $template = '0'; // 模板ID非短信运营商短信模板ID, 在config/easysms.php中配置sms_templates项
       $parameter = [
        'time' => 5,
        'operate' => '登录'
       ];  // 模板参数, 对应模板中的参数(除去首位code,代码中自动生成),按顺序传入任意数量, key键任意定义(不允许使用键名code会导致code被替换),代码会顺序替换为模板中的键名
       $gateways= ['chuanglanv2']; // 指定发送的短信服务商, 名称来自config/easysms.php中gateways项
       $result = $this->sendSms($mobile,$template,$parameter,$gateways);
       //['code' => true, 'msg' => '短信已发送', 'data' =>[
       'verificationCode_key'=>'verificationCode_sfsdfsdserewxxer',
       'prev_time'=> 1779772561 //上次请求发送短信的时间戳,用户限流,间隔时间配置在config/easysms.php中code.interval项
       ]]
     }

     public function store(Request $request)
     {
       //扩展了验证规则sms_code_check, 用于校验验证码是否正确
       $request->validate([
           'mobile' => 'required|regex:/^1[3456789]\d{9}$/', //手机号
           'verificationCode_key' => 'required', //验证码key,即上一步发送短信返回的key
            'code' => 'required|sms_code_check:'.$request->verificationCode_key','.$request->mobile,
        ]);
        ...
      }
}

```

在其他处使用
------

[](#在其他处使用)

如果不使用trait的话，可以直接使用以下简单调用

```
        $mobile = '177xxx1234';
        $code = 123456;
        $template = '102xxx388'; // 模板ID
         //内容为：您的验证码是{param1}，{param2}分钟内有效，您正在操作{param3}，请勿泄露。
        $gateways = ['chuanglanv2'];

         app('easysms')->send($mobile,
            [
                'template' => $template,
                'data' => [
                    'param1' => $code,
                    'param2' => 5,
                    'param3' => '登录'
                ]

            ], $gateways);
```

如果需要处理异常或者发送失败通知，可以监听Xin6841414\\EasySms\\Events\\ExceptionCustomEvent事件：

其他用法请参考 [overtrue/easy-sms](https://github.com/overtrue/easy-sms)

鸣谢
--

[](#鸣谢)

代码参考: [leonis/easysms-notification-channel](https://github.com/yl/easysms-notification-channel)

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance92

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

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

Total

3

Last Release

38d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20766942?v=4)[xin6841414](/maintainers/xin6841414)[@xin6841414](https://github.com/xin6841414)

---

Top Contributors

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

---

Tags

laraveleasysmschuanglanv2

### Embed Badge

![Health badge](/badges/xin6841414-easy-sms/health.svg)

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

###  Alternatives

[leonis/easysms-notification-channel

EasySms Notification Channel for Laravel.

15842.0k](/packages/leonis-easysms-notification-channel)[tzsk/sms

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

319270.8k6](/packages/tzsk-sms)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

254168.5k](/packages/erag-laravel-disposable-email)[coreproc/nova-notification-feed

A Laravel Nova package that adds a notification feed in your Nova app.

9949.3k](/packages/coreproc-nova-notification-feed)[matthewbdaly/laravel-sms

A Laravel and Lumen integration for matthewbdaly/sms-client to enable sending SMS messages

3529.8k](/packages/matthewbdaly-laravel-sms)

PHPackages © 2026

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