https://github.com/hongyukeji/sms
:iphone: SMS - 短信发送,从未如此简单。全网首款支持所有短信服务商,自由扩展,无缝对接。
https://github.com/hongyukeji/sms
laravel-sms php-sms sms thinkphp-sms yii-sms
Last synced: 5 months ago
JSON representation
:iphone: SMS - 短信发送,从未如此简单。全网首款支持所有短信服务商,自由扩展,无缝对接。
- Host: GitHub
- URL: https://github.com/hongyukeji/sms
- Owner: hongyukeji
- Created: 2018-08-02T13:31:12.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-08-11T11:36:26.000Z (almost 5 years ago)
- Last Synced: 2024-11-25T08:33:13.873Z (6 months ago)
- Topics: laravel-sms, php-sms, sms, thinkphp-sms, yii-sms
- Language: PHP
- Homepage: https://www.hongyuvip.com
- Size: 87.9 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
SMS - 短信发送,从未如此简单
> 全网首款支持所有短信服务商,自由扩展,无缝对接。
> 采用鸿宇科技专利[《宏观设计模式》](docs/README.md)开发。
> 更多请点击 [https://www.hongyuvip.com](https://www.hongyuvip.com)
> 项目迁移至 [https://github.com/hongyukeji/php-sms](https://github.com/hongyukeji/php-sms)
## 特点
- 支持全网络短信服务商
- 支持自由扩展且易维护## 支持
- [阿里云](https://www.aliyun.com)
- [云片网](https://www.yunpian.com)
- [腾讯云](https://cloud.tencent.com/product/sms)
- [短信宝](http://www.smsbao.com)
- [赛邮云](https://www.mysubmail.com)
- [SendCloud](https://www.sendcloud.net)
- [互亿无线](http://www.ihuyi.com)
- [创蓝253](https://www.253.com)
- 上述短信服务商比较常用,其他短信如有需要可联系[Shadow](http://wpa.qq.com/msgrd?v=3&uin=1527200768&site=qq&menu=yes)集成
- 如需支持其他短信服务商,可以自行Fork,在`src/Sms.php`中添加对应的短信发送方法即可
- 短信快速集成(参考[《宏观设计模式》](docs/README.md) — 鸿宇科技出品)## 环境
- PHP >= 5.6.0
## 安装
```shell
$ composer require hongyukeji/sms
```## 使用
> PHP框架中使用,配置文件参考 'docs/config/config.php'
> 短信发送参数详解: send([参数1-手机号: 支持字符串和数组格式],[参数2-模板: 支持模板Code和模板内容],[参数3-模板参数: 模板对应的参数, 数组格式],[参数4-短信服务商: 设置短信发送服务商, 该参数为空时调用配置文件中默认短信服务商])
```php
use HongYuKeJi\Helpers\Sms;$config = [
'default' => [
'gateway' => 'aliyun',
],
'gateways' => [
'yunpian' => [
'apikey' => '',
],
'aliyun' => [
'accessKeyId' => '',
'accessKeySecret' => '',
'signName' => '',
],
'qcloud' => [
'appid' => '',
'appkey' => '',
'smsSign' => '',
],
'duanxinbao' => [
'user' => '',
'pass' => '',
'signName' => '',
],
'submail' => [
'appid' => '',
'appkey' => '',
],
'sendcloud' => [
'sms_user' => '',
'sms_key' => '',
],
'ihuyi' => [
'apiid' => '',
'apikey' => '',
],
],
];$sms = new Sms($config);
// templateCode + templateParam
$resultTemplateCode = $sms->send('13800138000', 'SMS_88888888', [
'code' => '1234',
'time' => '15分钟',
]);var_dump($resultTemplateCode);
// templateContent + templateParam
$resultTemplateContent = $sms->send(['13800138000', '13900139000'], '您的验证码是%s。有效期为%s,请尽快验证!', [
'code' => '1234',
'time' => '15分钟',
], 'duanxinbao');var_dump($resultTemplateContent);
// return 返回值 status: success => 发送成功, fail => 发送失败
$result = [
'status' => 'success',
'message' => '短信发送成功!',
];
```## 维护
- Author:Shadow
- QQ:[1527200768](http://wpa.qq.com/msgrd?v=3&uin=1527200768&site=qq&menu=yes)
- Email:[[email protected]](mailto:[email protected])
- QQ交流群:[90664526](http://shang.qq.com/wpa/qunwpa?idkey=a3e498d7d3329615c9b3d1dbbbc50e43fa80b39e93a1ae78f1fb0a268f3a0476)## 配置
- [阿里云](https://help.aliyun.com/document_detail/55451.html)
> 使用说明:templateCode + templateParam
```php
'aliyun' => [
'accessKeyId' => '',
'accessKeySecret' => '',
'signName' => '',
],
```- [云片网](https://www.yunpian.com/doc/zh_CN/introduction/demos/php.html)
> 使用说明:templateCode + templateParam
```php
'yunpian' => [
'apikey' => '',
],
```- [腾讯云](https://cloud.tencent.com/document/product/382/9557)
> 使用说明:templateCode + templateParam
```php
'qcloud' => [
'appid' => '',
'appkey' => '',
'smsSign' => '',
],
```- [短信宝](http://www.smsbao.com/openapi/55.html)
> 使用说明:templateContent + templateParam
```php
'duanxinbao' => [
'user' => '',
'pass' => '',
'signName' => '',
],
```- [赛邮云](https://www.mysubmail.com/chs/documents/developer/t2f1J2)
> 使用说明:templateCode + templateParam
```php
'submail' => [
'appid' => '',
'appkey' => '',
],
```- [SendCloud](https://www.sendcloud.net/doc/sms)
> 使用说明:templateCode + templateParam
```php
'sendcloud' => [
'sms_user' => '',
'sms_key' => '',
],
```- [互亿无线](http://www.ihuyi.com/demo/sms/php.html)
> 使用说明:templateContent + templateParam
```php
'ihuyi' => [
'apiid' => '',
'apikey' => '',
],
```- [创蓝253](https://zz.253.com/api_doc/)
> 使用说明:templateContent + templateParam
```php
'chuanglan' => [
'api_send_url' => '',
'api_variable_url' => '',
'api_balance_query_url' => '',
'api_account' => '',
'api_password' => '',
'sms_sign' => '',
],
```