Download the PHP package niweisi/aliyun-dysms-php-sdk without Composer

On this page you can find all versions of the php package niweisi/aliyun-dysms-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package aliyun-dysms-php-sdk

aliyun-dysms-php-sdk

阿里云-云通信PHP版sdk,非原先阿里大于SDK,原阿里大鱼被合并进了“阿里云-云通信”。

“阿里云-云通信”的SDK已变化,原先阿里大鱼的SDK已无法使用,此git库为新版“阿里云-云通信”提供的SDK打成composer包

为了便于composer管理,特制作该git库,版权归阿里所有

composer安装

composer require niweisi/aliyun-dysms-php-sdk

composer安装后用法就跟官方文档没什么区别了,做个示例:

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;

// 阿里云Access Key ID和Access Key Secret 从 https://ak-console.aliyun.com 获取
$appKey = '你的Access Key ID';
$appSecret = '你的Access Key Secret';

// 短信签名 详见:https://dysms.console.aliyun.com/dysms.htm?spm=5176.2020520001.1001.3.psXEEJ#/sign
$signName  = '你的短信签名';

// 短信模板Code https://dysms.console.aliyun.com/dysms.htm?spm=5176.2020520001.1001.3.psXEEJ#/template
$template_code = '你的短信模版CODE';

// 短信中的替换变量json字符串
$json_string_param = '你的短信变量替换字符串';

// 接收短信的手机号码
$phone = '接收短信的手机号码';

// 初始化阿里云config
AliyunConfig::load();
// 初始化用户Profile实例
$profile = DefaultProfile::getProfile("cn-hangzhou", $appKey, $appSecret);
DefaultProfile::addEndpoint("cn-hangzhou", "cn-hangzhou", "Dysmsapi", "dysmsapi.aliyuncs.com");
$acsClient = new DefaultAcsClient($profile);
// 初始化SendSmsRequest实例用于设置发送短信的参数
$request = new SendSmsRequest();
// 必填,设置短信接收号码
$request->setPhoneNumbers($phone);
// 必填,设置签名名称
$request->setSignName($signName);
// 必填,设置模板CODE
$request->setTemplateCode($template_code);

// 可选,设置模板参数
if(!empty($json_string_param)) {
    $request->setTemplateParam($json_string_param);
}

// 可选,设置流水号
// if($outId) {
//     $request->setOutId($outId);
// }

// 发起请求
$acsResponse =  $acsClient->getAcsResponse($request);
// 默认返回stdClass,通过返回值的Code属性来判断发送成功与否
if($acsResponse && strtolower($acsResponse->Code) == 'ok')
{
    return true;
}
return false;

All versions of aliyun-dysms-php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package niweisi/aliyun-dysms-php-sdk contains the following files

Loading the files please wait ....