定制 codemonkey76/laravel-clicksend 二次开发

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

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

codemonkey76/laravel-clicksend

最新稳定版本:v1.0.1

Composer 安装命令:

composer require codemonkey76/laravel-clicksend

包简介

Laravel wrapper for ClickSend Rest API

README 文档

README

Latest Version on Packagist Total Downloads GitHub Actions

This is a laravel wrapper for ClickSend's REST API, currently only implementing sending SMS and getting delivery receipts for those messages.

Installation

You can install the package via composer:

composer require codemonkey76/laravel-clicksend

Config

Optionally you can publish the config file if you would like to modify the config.

php artisan vendor:publish --provider="Codemonkey76\ClickSend\ClickSendServiceProvider"

Environment

Add the following to your .env file and set the values from your clicksend account.

CLICKSEND_USERNAME=<your username goes here>
CLICKSEND_PASSWORD=<your api key goes here>

Optionally if you need to modify the api endpoint, you can also define the following.

CLICKSEND_API_ENDPOINT=*<api endpoint goes here>*

Usage

Example 1. Sending a single message and retreiving the delivery receipt.

use Codemonkey76\ClickSend\SmsMessage;

$recipient = '1234567890';
$senderId  = '1234567890';
$body      = 'Test Message';

$message = new SmsMessage($recipient, $senderId, $body);

$response = ClickSend::SendMessage($message);

// Some time later, get the receipt.
sleep(5);

ClickSend::GetMessageReceipt($response->data->messages[0]->message_id);

Example 2. Send multiple messages and retrieve their delivery receipts.

use Codemonkey76\ClickSend\SmsMessage;

$message1 = new SmsMessage('1234567890', '1234567890', 'Test Message #1');
$message2 = new SmsMessage('1234567890', '1234567890', 'Test Message #2');
$message3 = new SmsMessage('1234567890', '1234567890', 'Test Message #3');
$message4 = new SmsMessage('1234567890', '1234567890', 'Test Message #4');

$response = ClickSend::SendMessage([$message1, $message2, $message3, $message4]);

// Some time later, get the receipts.
sleep(5);

$receipt1 = ClickSend::GetMessageReceipt($response->data->message[0]->message_id);
$receipt2 = ClickSend::GetMessageReceipt($response->data->message[1]->message_id);
$receipt3 = ClickSend::GetMessageReceipt($response->data->message[2]->message_id);
$receipt4 = ClickSend::GetMessageReceipt($response->data->message[3]->message_id);

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 shane@alphasg.com.au 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.

统计信息

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

GitHub 信息

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

其他信息

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