wearesho-team/alphasms-message-delivery 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wearesho-team/alphasms-message-delivery

Composer 安装命令:

composer require wearesho-team/alphasms-message-delivery

包简介

Message Delivery AlphaSMS integration

README 文档

README

Test & Lint Latest Stable Version Total Downloads codecov

wearesho-team/message-delivery implementation of Delivery\ServiceInterface

Installation

composer require wearsho-team/alphasms-message-delivery:^3.0

Cli Usage

You can use simple CLI tool to send messages and check balance:

# Check balance
./alphasms balance
# Send messages interactively
./alphasms send

Usage

Configuration

Variable Required Description
ALPHASMS_SENDER_NAME yes Sender Name for SMS (alpha-name)
ALPHASMS_API_KEY yes Can be received on AlphaSMS Panel
ALPHASMS_WEBHOOK_URL no URL for Webhooks with SMS statuses

VoiceOTP Service

This section describes how to use the Voice OTP functionality of the AlphaSMS service.

Usage

The AlphaSMS service provides a method to send one-time passwords (OTP) via voice calls. This is useful for two-factor authentication or verification processes.

<?php

/** @var \Wearesho\Delivery\AlphaSms\Service $service */

// Create a Voice OTP request
$request = new \Wearesho\Delivery\AlphaSms\VoiceOtp\Request(
    id: 12345,                  // Unique identifier for the request
    phoneNumber: '380991234567' // Phone number to receive the voice call
);

try {
    // Send the Voice OTP request
    $response = $service->voiceOtp($request);

    // Get the OTP code (4 digits)
    $code = $response->code();

    // Get the price of the operation
    $price = $response->price();

    echo "Voice OTP sent successfully. Code: {$code}, Price: {$price}";
} catch (\Wearesho\Delivery\Exception $e) {
    // Handle delivery exceptions
    echo "Failed to send Voice OTP: " . $e->getMessage();
}

Request Parameters

  • id (int): A unique identifier for the request. This can be used for tracking or reference purposes.
  • phoneNumber (string): The recipient's phone number in international format (e.g., 380991234567).

Response Properties

  • code() (string): Returns the 4-digit OTP code that was sent to the recipient.
  • price() (float): Returns the cost of the voice call operation.

Error Handling

The voiceOtp() method may throw a \Wearesho\Delivery\Exception in the following cases:

  • Invalid request parameters
  • Network connectivity issues
  • Service provider errors
  • Invalid response format

Always wrap the service call in a try-catch block to handle potential exceptions.

Command Line Interface

For command-line usage, you can use the provided Symfony Console command:

# Basic usage
$ ./alphasms voice-otp 380991234567

# With custom request ID
$ ./alphasms voice-otp 380991234567 --id=12345

Authors

License

MIT

wearesho-team/alphasms-message-delivery 适用场景与选型建议

wearesho-team/alphasms-message-delivery 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 155 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 05 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 wearesho-team/alphasms-message-delivery 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 wearesho-team/alphasms-message-delivery 我们能提供哪些服务?
定制开发 / 二次开发

基于 wearesho-team/alphasms-message-delivery 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 155
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 11
  • 依赖项目数: 0
  • 推荐数: 1

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-05-15