springedge/laravel-sms

此包的最新版本(dev-master)没有可用的许可证信息。

使用 Spring Edge 短信网关 API 从 Laravel 发送短信

dev-master 2021-05-09 05:29 UTC

This package is not auto-updated.

Last update: 2024-09-18 14:17:12 UTC


README

使用 Spring Edge (https://www.springedge.com) API 将短信发送功能添加到您的 Laravel 中

需求

  • 安装和设置 Laravel 工作环境
  • 注册 免费试用消息账户
  • 在短信账户的开发者部分创建一个新的 apikey
  • 设置短信账户的发送者名称。

安装

通过 composer

composer require springedge/laravel-sms

或者将以下内容添加到您的 composer.json 文件中,然后运行 "composer update"

"require": {
    ...
    "springedge/laravel-sms": "1.0.*"
}

用法

发送短信

apikey = "675031xxxxxxxxxxxx"
sender = "SEDEMO"

sms = SmsApi(apikey, sender)

sms = sms.send_sms(
    recipient="902000xxxx",
    message="Hello, This is a test message from spring edge"
)

成功响应

{
 "groupID":xxxxxx,
 "MessageIDs":"xxxxxxx-xx",
 "status":"AWAITED-DLR"
}

或者出错时

{
  "error":"Invalid Mobile Numbers"
}

支持

有关任何支持或查询,请访问: https://www.springedge.com