定制 kssadi/sslwirelesssms 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

kssadi/sslwirelesssms

Composer 安装命令:

composer require kssadi/sslwirelesssms

包简介

A Laravel package to integrate SSL Wireless SMS service.

README 文档

README


SSL Wireless SMS Laravel Package

SSL Wireless SMS Laravel Package

A Laravel package for integrating SSL Wireless SMS service into your Laravel applications. Easily send single, bulk, and dynamic SMS messages using this package.

GitHub Repo stars Downloads GitHub license GitHub top language Packagist Version

Features

  • Single SMS: Send a single SMS message to a phone number.
  • Bulk SMS: Send SMS messages to multiple phone numbers in a single request.
  • Dynamic SMS: Send SMS messages dynamically with varying content.

Table of Contents

Requirements

  • PHP >= 8.0
  • Laravel >= 10

Installation

  1. Install the package via Composer:

    composer require kssadi/sslwirelesssms
  2. Publish the configuration file:

    php artisan vendor:publish --provider="KsSadi\SSLWirelessSMS\SSLWirelessSMSServiceProvider" --tag="config"

    This will publish the sslwireless.php configuration file to your config directory.

Configuration

Add your SSL Wireless SMS credentials to the config/sslwireless.php file

return [
    'api_token' => env('SSLWIRELESS_API_TOKEN', ''),
    'sid' => env('SSLWIRELESS_SID', ''),
    'domain' => env('SSLWIRELESS_DOMAIN', 'https://smsplus.sslwireless.com'),
    'message_type' => env('SSLWIRELESS_MESSAGE_TYPE', 'EN'),
];

Add these values to your .env file:

SSLWIRELESS_API_TOKEN=your_api_token
SSLWIRELESS_SID=your_sid

Usage

With this package, you can send single, bulk, or dynamic SMS messages using a unified method sendSms(). This method simplifies the process by handling all types of SMS through a single function. If you prefer, you can also use separate methods for each type of SMS.

Unified SMS Sending

The sendSms() method allows you to send different types of SMS with a single function, depending on the data you provide:

Single SMS: Send a single SMS message to one phone number.
Bulk SMS: Send the same SMS message to multiple phone numbers.
Dynamic SMS: Send different SMS messages to multiple phone numbers.

Example: Sending Single SMS

use KsSadi\SSLWirelessSMS\Facades\SSLWirelessSMS;

$response = SSLWirelessSMS::sendSms([
'phoneNumber' => '1234567890',
'messageBody' => 'Hello World'
], 'txn123');

Example: Sending Bulk SMS

use KsSadi\SSLWirelessSMS\Facades\SSLWirelessSMS;

$response = SSLWirelessSMS::sendSms([
    'phoneNumbers' => ['1234567890', '0987654321'],
    'messageBody' => 'Hello, this is a test message for bulk SMS.'
], 'batch123');

Example: Sending Dynamic SMS

use KsSadi\SSLWirelessSMS\Facades\SSLWirelessSMS;

$response = SSLWirelessSMS::sendSms([
    'messages' => [
        ['phoneNumber' => '1234567890', 'message' => 'Hello, User 1!', 'sms_id' => 'sms1'],
        ['phoneNumber' => '0987654321', 'message' => 'Hello, User 2!', 'sms_id' => 'sms2']
    ]
]);

Separate Methods

If you prefer to use separate methods for each type of SMS, you can do so as follows:

sendSingleSms(): Send a single SMS message.
sendBulkSms(): Send SMS messages to multiple phone numbers.
sendDynamicSms(): Send different SMS messages to multiple phone numbers.

Example: Sending Single SMS

use KsSadi\SSLWirelessSMS\Facades\SSLWirelessSMS;

$response = SSLWirelessSMS::sendSingleSms('1234567890', 'Hello, world!', 'TX123');

Example: Sending a Bulk SMS

use KsSadi\SSLWirelessSMS\Facades\SSLWirelessSMS;

$phoneNumbers = ['1234567890', '0987654321'];
$response = SSLWirelessSMS::sendBulkSms($phoneNumbers, 'Hello, world!', 'TX123');

Example: Sending a Dynamic SMS

use KsSadi\SSLWirelessSMS\Facades\SSLWirelessSMS;

$messageData = [
    [
        'phone_number' => '1234567890',
        'message' => 'Hello, John!',
        "sms_id" => uniqid() //must be unique
    ],
    [
        'phone_number' => '0987654321',
        'message' => 'Hello, Jane!',
        "sms_id" => uniqid() //must be unique
    ]
];

$response = SSLWirelessSMS::sendDynamicSms($messageData);

Author

Name: Khaled Saifullah Sadi
Email: mdsadi4@gmail.com

Buy Me a Coffee

Social Handles

LinkedIn Facebook Instagram Twitter Github

Contributing

Please feel free to contribute to this package and submit a pull request.

License

This package is open-source software licensed under the MIT license.

Key Sections:

  • Features: Highlights the capabilities of the package.
  • Table of Contents: Provides an overview for easy navigation.
  • Installation: Instructions to install the package.
  • Configuration: Details on setting up configuration.
  • Usage: Examples of how to use the package functions.
  • Testing: Instructions for running tests.
  • Author: Information about the package author.
  • Contributing: Guidelines for contributing to the project.
  • License: Information about the package's licensing.

Feel free to adjust the content as needed based on your specific use cases or additional features.

Copyright 2024 Khaled Saifullah Sadi

kssadi/sslwirelesssms 适用场景与选型建议

kssadi/sslwirelesssms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 29 次下载、GitHub Stars 达 7, 最近一次更新时间为 2024 年 09 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「sslwireless」 「SSLWireless SMS」 「SSLWireless SMS Laravel」 「SSLWireless SMS for Laravel」 「SSLWireless Bulk SMS」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 kssadi/sslwirelesssms 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-09