2017 © Pedro Peláez
 

library aliyun-dysms-php-sdk

Aliyun SMS SDK for PHP

image

suhaoxiang/aliyun-dysms-php-sdk

Aliyun SMS SDK for PHP

  • Thursday, December 21, 2017
  • by qiandutianxia
  • Repository
  • 1 Watchers
  • 0 Stars
  • 41 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 32 % Grown

The README.md

aliyun-dysms-php-sdk

安装方法, (*1)

composer install suhaoxiang/aliyun-dysms-php-sdk

>, (*2)

使用方法, (*3)

    use Aliyun\Core\Config as AliyunConfig;
    use Aliyun\Core\Profile\DefaultProfile;
    use Aliyun\Core\DefaultAcsClient;
    use Aliyun\Api\Sms\Request\V20170525\SendSmsRequest;
    use Aliyun\Api\Sms\Request\V20170525\QuerySendDetailsRequest;

    $mobile='xxxxxx';   //电话号码

    $appKey = '';       //app key
    $appSecret = '';    //app secret
    $signName  = '';    //前面
    $template_code = '';//模板名称
    $json_string_param = json_encode(Array(
        "code"=>rand(100000,999999)
    ));

    AliyunConfig::load();
    $profile = DefaultProfile::getProfile("cn-hangzhou", $appKey, $appSecret);
    DefaultProfile::addEndpoint("cn-hangzhou", "cn-hangzhou", "Dysmsapi", "dysmsapi.aliyuncs.com");
    $acsClient = new DefaultAcsClient($profile);
    $request = new SendSmsRequest();
    $request->setPhoneNumbers($mobile);
    $request->setSignName($signName);
    $request->setTemplateCode($template_code);
    if(!empty($json_string_param)) {
        $request->setTemplateParam($json_string_param);
    }

    $acsResponse =  $acsClient->getAcsResponse($request);

    if($acsResponse && strtolower($acsResponse->Code) == 'ok')
    {
        return ['code'=>1,"msg"=>"发送短信验证码成功"];
    }
    return ['code'=>0,"msg"=>"发送短信验证码失败"];

The Versions

21/12 2017

dev-master

9999999-dev https://www.aliyun.com/product/sms

Aliyun SMS SDK for PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.5.0

 

The Development Requires

sms sdk aliyun

21/12 2017

1.0

1.0.0.0 https://www.aliyun.com/product/sms

Aliyun SMS SDK for PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.5.0

 

The Development Requires

sms sdk aliyun