承接 bluedot-bd/laravel-bulk-sms 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

bluedot-bd/laravel-bulk-sms

最新稳定版本:1.0.6

Composer 安装命令:

composer require bluedot-bd/laravel-bulk-sms

包简介

'laravel-bulksms' is a Laravel package for integrating with an HTTP-based SMS gateway. The package is compatible with SMS providers in Bangladesh and other countries, and allows for the sending of notifications via Laravel notifications. It also includes a feature for checking the balance of an SMS

README 文档

README

Latest Version on Packagist Total Downloads GitHub Actions

"laravel-bulksms" is a Laravel package for integrating with any HTTP-based SMS gateway. The package is compatible with SMS providers in Bangladesh and other countries, and allows for the sending of notifications via Laravel notifications. It also includes a feature for checking the balance of an SMS account with a supported provider. This package can be useful for integrating SMS functionality into a Laravel-based application, sending sms messages to people, and keeping track of SMS usage and account balances.

Installation

You can install the package via composer:

composer require bluedot-bd/laravel-bulk-sms

Usage

Check and Save Config

use LaravelBulksms;
$sms = new LaravelBulksms(); // config name not needed
$params = [
    'api_mode'         => 'dry', // dry/live
    'send_method'      => 'GET', // GET/POST
    'send_url'         => '',
    'send_header'      => '', // Comma separated header
    'send_success'     => '', // valid regex or empty (without delimiter)
    'send_error'       => '', // valid regex or empty (without delimiter)
    'balance_url'      => '',
    'balance_method'   => '', // GET/POST
    'balance_header'   => '', // Comma separated header
    'balance_key'      => '', // json object key
];
$config = 'smsdone'; // any name you want, this will be your config file name
$url = ''; // your api url with all params
try {
    $sms->checkAndSave($params, $url, $config);
} catch (Exception $e) {
    // Get Error from Exception
    // If you get this error, create a issue with your api url (please remove any api key or password)
}

You can use it in Notification (for sending sms):

use LaravelBulksms;
use BluedotBd\LaravelBulksms\SmsChannel;

public function via($notifiable)
{
    return [SmsChannel::class];
}

/**
 * Get the sms representation of the notification.
 *
 * @param  mixed  $notifiable
 */
public function toSms($notifiable)
{
    return (new LaravelBulksms("config_file_name"))
        ->to()
        ->line();
}

or you can use it directly:

use LaravelBulksms;
$sms = new LaravelBulksms("config_file_name");
try {
    $sms->to('01xxxx')->message('Your SMS Text')->send();   
} catch (Exception $e) {
    // SMS Sending Error
}

or Send SMS useing Laravel Queued Jobs

dispatch(new BluedotBd\LaravelBulksms\Jobs\SendSMS($config,$number, $message));
// or
dispatch((new BluedotBd\LaravelBulksms\Jobs\SendSMS($config,$number, $message))->onQueue('high'));
// or
dispatch((new BluedotBd\LaravelBulksms\Jobs\SendSMS($config,$number, $message))->delay(60));

Get Balance if Supported

use LaravelBulksms;
$sms = new LaravelBulksms("config_file_name");
$sms->balance(); // returns float

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email saiful@bluedot.ltd instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-07-06