定制 jbbx2016/sms-gateway 二次开发

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

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

jbbx2016/sms-gateway

Composer 安装命令:

composer require jbbx2016/sms-gateway

包简介

SMS Gateway to interface with Eurobate

README 文档

README

Library to send SMS using Eurobate gateway

Installation using Composer

composer require jbbx2016/sms-gateway

Basic usage

<?php

use JBBx2016\SMSGateway\Common\CountryCodes;
use JBBx2016\SMSGateway\Common\Exceptions\Exception;
use JBBx2016\SMSGateway\Common\PhoneNumber;
use JBBx2016\SMSGateway\Gateways\Eurobate\EurobateSendMessageResponse;
use JBBx2016\SMSGateway\Gateways\Eurobate\EurobateGateway;
use JBBx2016\SMSGateway\Payloads\SMSPayload;
use JBBx2016\SMSGateway\Senders\TextSender;
use JBBx2016\SMSGateway\SMSGatewayApi;

$SMSGatewayApi = new SMSGatewayApi();

$SMSGatewayApi->AddGateway(new EurobateGateway('username', 'password'));

try {

    /** @var EurobateSendMessageResponse $Response */
    $Response = $SMSGatewayApi->SendMessage(
        new TextSender('Avsender'),
        new SMSPayload(
            new PhoneNumber(CountryCodes::Norway, '98765432'),
            "This is the message body"
        )
    );
    
    $EurobateId = $Response->Id;

} catch (Exception $Exception) {

    $this->_Logger->Error('Failed to process SMS - Exception: ' . get_class($Exception) . "(" . $Exception->getMessage() . ")");

}

Send SMS from number

<?php

use JBBx2016\SMSGateway\Common\CountryCodes;
use JBBx2016\SMSGateway\Common\PhoneNumber;
use JBBx2016\SMSGateway\Payloads\SMSPayload;
use JBBx2016\SMSGateway\Senders\NumberSender;

$SMSGatewayApi->SendMessage(
    new NumberSender('203098765432'),
    new SMSPayload(
        new PhoneNumber(CountryCodes::Norway, '98765432'),
        "This is the message body"
    )
);

Eurobate: Specify delivery report endpoint

<?php

use JBBx2016\SMSGateway\Gateways\Eurobate\EurobateGateway;
use JBBx2016\SMSGateway\SMSGatewayApi;


$EurobateGateway = new EurobateGateway('username', 'password');
$EurobateGateway->SetDeliveryReportStatusEndpoint('http:// myhost.com/dlr.php?msgid=MSGID&status=STATUS&operator=OPERATOR&smscode=OPCODE&cbgcode=CBGCODE&stop=STOP');

$SMSGatewayApi = new SMSGatewayApi();
$SMSGatewayApi->AddGateway($EurobateGateway);

Exceptions

  • JBBx2016\SMSGateway\Common\Exceptions\Exception: Base exception
    • JBBx2016\SMSGateway\Common\Exceptions\GatewayEndpointConnectionFailedException: Connection to gateway endpoint failed
    • JBBx2016\SMSGateway\Common\Exceptions\GatewayAuthorizationException: Gateway authorization failed
    • JBBx2016\SMSGateway\Common\Exceptions\NoGatewayFoundException: Called if no appropriate gateway is found
    • JBBx2016\SMSGateway\Gateways\Eurobate\EurobateException: Exception for Eurobate gateway
      • JBBx2016\SMSGateway\Gateways\Eurobate\Exceptions\IPNotAuthorizedEurobateException: Eurobate specific error

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2017-02-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固