Giter Site home page Giter Site logo

singka-tech / singka-hwsms Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 9 KB

本项目集成了华为云短信发送业务,支持ThinkPHP5.0、ThinkPHP5.1和ThinkPHP6.0,由宁波晟嘉网络科技有限公司维护。

License: MIT License

PHP 100.00%
hua-wei huawei huaweicloud huaweisms thinkphp thinkphp6 thinkphp51 thinkphp5 laravel

singka-hwsms's Introduction

华为云短信

介绍

本项目集成了华为云短信发送业务,支持ThinkPHP5.0、ThinkPHP5.1和ThinkPHP6.0,由宁波晟嘉网络科技有限公司维护。

安装教程

使用 composer require singka/singka-hwsms 命令行安装即可。

使用示例(基于ThinkPHP6.0)

<?php
// +----------------------------------------------------------------------
// | 胜家云 [ SingKa Cloud ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.singka.net All rights reserved.
// +----------------------------------------------------------------------
// | 宁波晟嘉网络科技有限公司
// +----------------------------------------------------------------------
// | Author: ShyComet <[email protected]>
// +----------------------------------------------------------------------
namespace app\home\controller;

use SingKa\HwSms\HwSms;

class Index
{
    /**
    * 短信发送示例
    *
    * @url              华为云短信APP接入地址+接口访问URI
    * @appKey           华为云短信appKey
    * @appSecret        华为云短信appSecret
    * @sender           国内短信签名通道号或国际/港澳台短信通道号
    * @signature        华为云短信签名
    * @statusCallback   短信发送状态返回接收地址,可以为空
    */
    public function smsDemo()
    {
        $config['url'] = 'https://rtcsms.cn-north-1.myhuaweicloud.com:10743';
        $config['appKey'] = 'PkT889B*************wM0GAi';
        $config['appSecret'] = 'U58fd****************0o4N';
        $config['sender'] = 'csms12345678';
        $config['signature'] = '短信签名';
        $config['statusCallback'] = '短信发送状态返回接收地址,可以为空';
        $sms = new HwSms($config);
        $result = $sms->send('模板ID', '手机号码(多个号码可以用英文逗号隔开)', '短信变量数组');
        if ($result['code'] == '000000') {
            echo '发送成功';
        } else {
            echo $result['msg'];
        }
    }
  
}

其他说明

相关材料请查阅: 华为云短信介绍 SDK简介 API概览

作者联系方式:[email protected]

singka-hwsms's People

Contributors

shycomet avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.