woenel/itexmo

此软件包已被放弃且不再维护。没有建议的替代软件包。

iTexMo API for Laravel。

v0.3 2018-08-01 04:45 UTC

This package is auto-updated.

Last update: 2020-11-10 16:12:23 UTC


README

iTexMo API for Laravel。

Packagist

安装

使用 Composer 安装

$ composer require woenel/itexmo "^0.3"

发布名为 itexmo.php 的配置文件并设置 iTexMo API 代码。

$ php artisan vendor:publish --provider="Woenel\Itexmo\ItexmoServiceProvider"

使用方法

发送短信

您可以使用以下三种方法发送短信:

1. 使用外观
use Itexmo;

$res = Itexmo::to('09123456789')->message('Hello World!')->send();

if($res == '0') {
  // Success message or logic. Refer to the return codes below.
}
2. 实例化类
use Woenel\Itexmo;

$itexmo = new Itexmo;

$res = $itexmo->to('09123456789')->message('Hello World!')->send();

if($res == '0') {
  // Success message or logic. Refer to the return codes below.
}
3. 逐个实例化类
use Woenel\Itexmo;

$itexmo = new Itexmo;

$itexmo->to = '09123456789';
$itexmo->message = 'Hello World!';
$itexmo->send();

if($itexmo->result == '0') {
  // Success message or logic. Refer to the return codes below.
}

您可以选择其中任何一种。任何方式都应该有效。

返回代码

  • "0" = 成功!短信现在已在队列中,将很快发送。
  • "1" = 无效号码。
  • "2" = 不支持号码前缀。请与我们联系,以便我们添加。
  • "3" = 无效 ApiCode。
  • "4" = 每天短信数量上限已达到。这将在每天午夜12:00重置。
  • "5" = 短信字符数已达到最大允许值。
  • "6" = 系统离线。
  • "7" = ApiCode 已过期。
  • "8" = iTexMo 错误。请稍后再试。
  • "9" = 无效的函数参数。
  • "10" = 由于洪水,接收者的号码被封锁,消息被忽略。
  • "11" = 由于硬发送,接收者的号码临时被封锁,消息被忽略。
  • "12" = 无效请求。您不能在非企业 apicode 上设置消息优先级。
  • "13" = 无效或未注册的自定义发送者 ID。

特性

已实现特性

  • 发送短信
  • 检查 API 服务状态和您的 SMS 服务器状态(目前不在使用/文档中,将很快提供)
  • 检查 ApiCode 信息和状态(目前不在使用/文档中,将很快提供)

计划中的特性

  • 显示待发或已发出短信
  • 删除所有待发或已发出短信
  • 队列消息(通过队列发送短信)