2017 © Pedro Peláez
 

project sms

短信接口

image

aweitian/sms

短信接口

  • Monday, June 4, 2018
  • by awei.tian
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

sms

install

composer require aweitian/sms, (*1)

单条测试

$test = new \Aw\Sms\Ali\Send('LTA...YtG','UImf5*******aIm');
$test->setPhoneNumber("136........");
$test->setSignName("田AW");
$test->setTemplateCode("SMS_125015333");
$test->setTemplateParam(array (
  "code" => "102530",
));
$this->assertTrue($test->send());

批量测试

$test = new \Aw\Sms\Ali\BatchSend('LTAIj*****tG','UImf5c0Pmw******WfdaIm',__DIR__."/sms.log");
$test->setPhoneNumber(array('136******','1*******29'));
$test->setSignName(array("田AW","田AW"));
$test->setTemplateCode("SMS_125015333");
$test->setTemplateParam(array(
    array(
        "code" => "123",
    ),
    array(
        "code" => "456",
    ),
));
$this->assertTrue($test->send());
var_dump($test->log);

签名查询

$params = array(
    'SignName' => '十***理'
);

$helper = new SignatureHelper();

// 此处可能会抛出异常,注意catch
$content = $helper->request(
    'LTAI*****jnaqE',
    'SuO*********KVFgIxi',
    "dysmsapi.aliyuncs.com",
    array_merge($params, array(
        "RegionId" => "cn-hangzhou",
        "Action" => "QuerySmsSign",
        "Version" => "2017-05-25",
    )),
    true
);
var_dump($content);
"RequestId"=> "26D5E39A-A9AE-559B-8D65-487A932DB265"
"Message"=> "OK"
"SignStatus"=> 1 0:审核中。
                 1:审核通过。
                 2:审核失败,请在返回参数Reason中查看审核失败原因
"Code"=> "OK"
"CreateDate"=> "2021-10-16 11:12:54"
"Reason"=> "无审批备注"
"SignName"=> "十***理"

模板查询

$params = array(
    'TemplateCode' => 'SMS_226400252'
);

$helper = new SignatureHelper();

// 此处可能会抛出异常,注意catch
$content = $helper->request(
    'LT***naqE',
    'SuOU********VFgIxi',
    "dysmsapi.aliyuncs.com",
    array_merge($params, array(
        "RegionId" => "cn-hangzhou",
        "Action" => "QuerySmsTemplate",
        "Version" => "2017-05-25",
    )),
    true
);
var_dump($content);

"TemplateCode" => "SMS_226400252"
"Message"=> "OK"
"RequestId"=> "3D88FE8D-9463-5A75-9646-D94C94AEB15A"
"TemplateContent"=> "文件${title}已从平台下发,请你登陆签收"
"TemplateName"=> "文件发送短信通知"
"TemplateType"=> 1 0:验证码。
                   1:短信通知。
                   2:推广短信。
                   3:国际/港澳台消息。

"Code"=> "OK"
"CreateDate"=> "2021-10-16 11:43:00"
"Reason"=> "无审批备注"
"TemplateStatus"=> 1  0:审核中。
                      1:审核通过。
                      2:审核失败,请在返回参数Reason中查看审核失败原因。

The Versions

04/06 2018

dev-master

9999999-dev https://github.com/aweitian/sms

短信接口

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by aweitian

php sms

04/06 2018

v1.0.0

1.0.0.0 https://github.com/aweitian/sms

短信接口

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by aweitian

php sms