larva/laravel-sms
Composer 安装命令:
composer require larva/laravel-sms
包简介
This is a SMS.
README 文档
README
This is a sms expansion for the laravel
特点
- 支持目前市面多家服务商
- 一套写法兼容所有平台
- 简单配置即可灵活增减服务商
- 内置多种服务商轮询策略、支持自定义轮询策略
- 统一的返回值格式,便于日志与监控
- 自动轮询选择可用的服务商
- 更多等你去发现与改进...
平台支持
- 腾讯云 SMS
- Ucloud
- 七牛云
- SendCloud
- 阿里云
- 云片
- Submail
- 螺丝帽
- 容联云通讯
- 互亿无线
- 聚合数据
- 百度云
- 华信短信平台
- 253云通讯(创蓝)
- 融云
- 天毅无线
- 阿凡达数据
- 华为云
- 网易云信
- 云之讯
- 凯信通
- UE35.net
- 短信宝
- Tiniyo
- 摩杜云
- 融合云(助通)
- 蜘蛛云
- 融合云信
- 天瑞云
环境需求
- PHP >= 8.0
Installation
composer require larva/laravel-sms
for Laravel
This service provider must be registered.
// config/app.php 'providers' => [ '...', Larva\Sms\SmsServiceProvider::class, ];
add the config file: config/sms.php
add config
use Overtrue\EasySms\Strategies\OrderStrategy; return [ // HTTP 请求的超时时间(秒) 'timeout' => 5.0, /* |-------------------------------------------------------------------------- | Default Setting |-------------------------------------------------------------------------- | | This option defines the default sms gateway that gets used when writing | messages to the sms. The name specified in this option should match | one of the gateways defined in the "gateways" configuration array. | */ 'default' => [ // 网关调用策略,默认:顺序调用 'strategy' => OrderStrategy::class, /* |-------------------------------------------------------------------------- | Default Gateways |-------------------------------------------------------------------------- | | This option defines the default sms gateway that gets used when writing | messages to the sms. The name specified in this option should match | one of the gateways defined in the "gateways" configuration array. | */ 'gateways' => [ ], ], /* |-------------------------------------------------------------------------- | Log Gateways |-------------------------------------------------------------------------- | | Here you may configure the sms gateways for your application. This gives | you a variety of powerful log handlers / formatters to utilize. | | Available Drivers: "aliyun", "alidayu", "yunpian", "submail", | "errorlog", "luosimao", "yuntongxun", "huyi" | "juhe", "sendcloud", "baidu", "huaxin", "chuanglan" | "rongcloud", "tianyiwuxian", "twilio", "qcloud", "avatardata" | */ 'gateways' => [ //Doc // https://github.com/overtrue/easy-sms ], ];
Use
try { $res = sms('13800138000', ['content' => '您的验证码为: 6379','template' => '259734', 'data' => [6379]]); print_r($res); } catch (InvalidArgumentException $e) { print_r($e->getMessage()); } catch (NoGatewayAvailableException $e) { print_r($e->getMessage()); }
//如果要在 系统内使用短信通知通道 在User 模型增加
/** * 获取手机号 * @param \Illuminate\Notifications\Notification|null $notification * @return int */ public function routeNotificationForPhone($notification) { return $this->phone; }
获取手机号,通知实体类的通知渠道写 phone
larva/laravel-sms 适用场景与选型建议
larva/laravel-sms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.76k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 01 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「sms」 「laravel」 「Larva」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 larva/laravel-sms 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 larva/laravel-sms 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 larva/laravel-sms 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This is a transaction.
This is laravel settings module.
This is a Flysystem adapter for the Aliyun OSS.
SDK for payment gateway PlatbaMobilom.sk for PHP7.0
Extensible library for building notifications and sending them via different delivery channels.
This is a baidu push.
统计信息
- 总下载量: 3.76k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-01-23