dc/sms_link 问题修复 & 功能扩展

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

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

dc/sms_link

Composer 安装命令:

composer require dc/sms_link

包简介

Implementation of Link Mobility's Common Platform REST API over HTTP(S)

README 文档

README

This library implements Link Mobility's SMS gateway using JSON over HTTP(s). For now, only the CPA and bulk SMS messages are supported.

Installation

composer require dc/sms_link

or in composer.json

"require": {
    "dc/sms_link": "master"
}

Sending messages

require_once "vendor/autoload.php";

$configuration = new \DC\SMS\Link\Configuration();
$configuration->username = "username";
$configuration->password = "password";
$configuration->platformId = "platformId";
$configuration->platformPartnerId = "platformPartnerId";
$gateway = new \DC\SMS\Link\Gateway($configuration);

$message = new \DC\SMS\TextMessage("message text", "<msisdn>");

$receipt = $gateway->sendMessage($message);

if ($receipt->wasEnqueued()) {
    echo "Enqueued";
} else {
    echo "Failed";
}

Processing delivery reports

Set up your delivery end point so you can receive delivery reports Link Mobility sends you. Here is an example:

// assuming you have $gateway from above example
$report = $gateway->parseDeliveryReport(file_get_contents('php://input'));

// by default, use the successful response for the gateway
$return = $report->getSuccessfullyProcessedResponse();
if ($report->isSuccess()) {
  if (!$db->markMessageReceived($report->getMessageIdentifier())) {
    // we somehow couldn't save the information, so notify the gateway
    $return = $report->getErrorInProcessingReport();
  }
}

// tell the gateway that we processed (or didn't process) the message
http_response_code($return->getHTTPResponseCode());
foreach ($return->getHeaders() as $key => $value) {
	header(sprintf("%s: %s", $key, $value));
}
echo $return->getContent();

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固