sms_net_bd/sms 问题修复 & 功能扩展

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

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

sms_net_bd/sms

Composer 安装命令:

composer require sms_net_bd/sms

包简介

SMS Package for Laravel - Simplify SMS integration with the SMS Gateway from sms.net.bd. Send message, check balance, get delivery reports, and manage SMS effortlessly in your Laravel applications.

README 文档

README

Packagist version mit Packagist Downloads

SMS Package for Laravel - Simplify SMS integration with the SMS Gateway from sms.bd. Send messages, check balance, get delivery reports, and manage SMS effortlessly in your Laravel applications.

The SMS Laravel package provides convenient access to the sms.bd REST API from php applications.

Sign up for a free sms.bd account today and get your API Key from our advanced SMS platform. Plus, enjoy free credits to try out your API in full!

Example

Check out the other code examples

Features

  • Send SMS messages through the sms.bd sms gateway.
  • Schedule SMS messages for future delivery.
  • Send SMS to multiple recipients with sender id
  • Retrieve SMS delivery reports.
  • Check account balance and balance validity.

Requirements

  • Laravel Framework 7.x
  • PHP 7.2 or higher

Installation

Install the package via Composer:

composer require sms_net_bd/sms

Set your SMS API key in the .env file:

SMS_NET_BD_API_KEY=your-api-key

Note: Ensure to replace placeholder your-api-key with your actual API key

Usage

use sms_net_bd\SMS; // Import the SMS class

// Create an instance of the class
$sms = new SMS();

try {
    // Send Single SMS
    $response = $sms->sendSMS(
        "Hello, this is a test SMS!",
        "01701010101"
    );

    // Send Multiple Recipients SMS
    $response = $sms->sendSMS(
        "Hello, this is a test SMS!",
        "01701010101,+8801856666666,8801349494949,01500000000"
    );

    // Send SMS With Sender ID or Masking Name
    $response = $sms->sendSMS(
        "Hello, this is a test SMS!",
        "01701010101",
        "sms.net.bd"
    );

    // Schedule SMS for future delivery
    $response = $sms->sendScheduledSMS(
        "Scheduled SMS",
        "8801701010101",
        "2023-12-01 14:30:00" // Date format: YYYY-MM-DD HH:MM:SS
    );

    // Schedule SMS for future delivery with Sender ID
    $response = $sms->sendScheduledSMS(
        "Scheduled SMS with date",
        "8801701010101",
        "2023-12-01 14:30:00",
        "sms.net.bd"
    );

    // Get SMS delivery report
    $report = $sms->getReport($requestId);

    // Check account balance
    $balanceInfo = $sms->getBalance();

} catch (Exception $e) {
    // handle $e->getMessage();
}

Note: Ensure to replace placeholder values with your phone numbers and messages.

Error Handling

The package provides better error handling. If the API response has an error (error != 0), an exception is thrown with the error message.

try {
    $response = $sms->sendSMS('Invalid Recipient', '+invalid-number');
} catch (\Exception $e) {
    // Handle the exception, log the error, or display a user-friendly message.
    echo 'Error: ' . $e->getMessage();
}

License

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

Contribution

Contributions are welcome! Feel free to submit issues or open a pull request.

Support

If you have any questions or feedback, please open an issue or open a pull request.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-12-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固