作者 潘浩文
1 个管道 的构建 通过 耗费 1 秒

模拟渲染

正在显示 36 个修改的文件 包含 4840 行增加1 行删除

要显示太多修改。

为保证性能只显示 36 of 36+ 个文件。

... ... @@ -101,7 +101,7 @@ class TestController extends WeChatBaseController
$r = $clnt->sms()->single_send($param);
var_dump($r);
if($r->isSucc()){
$r->data()
$r->data();
}
}
}
... ...
.buildpath
.project
.settings/
/vendor/
composer.phar
.vscode/
... ...
## v1.0.0
- 运行环境 >=php5.6
- 支持v1/v2所有接口
- 单元测试覆盖所有接口
\ No newline at end of file
... ...
The MIT License (MIT)
Copyright (c) 2016 云片网络
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
... ...
yunpian-php-sdk
================================
[云片](https://www.yunpian.com/) SDK
## 快速开始
- 添加composer依赖
```json
"require" : {
"yunpian/yunpian-php-sdk" : "~1.0"
}
```
**注**: master是最新稳定版。我们会更新到[Packagist](https://packagist.org/explore/)
- 使用YunpianClient
```php
use \Yunpian\Sdk\YunpianClient;
//初始化client,apikey作为所有请求的默认值
$clnt = YunpianClient::create($apikey);
//修改账户信息API
$param = [YunpianClient::MOBILE => '18616020000',YunpianClient::TEXT => '【云片网】您的验证码是1234'];
$r = $clnt->sms()->single_send($param);
var_dump($r);
//账户 $clnt->user() 签名 $clnt->sign() 模版 $clnt->tpl() 短信 $clnt->sms() 语音 $clnt->voice() 流量 $clnt->flow()
```
**注**: v1.0开始使用composer管理工程。不兼容之前版本,若需要可从github下载[0.0.1](https://github.com/yunpian/yunpian-php-sdk/releases/tag/0.0.1)
## 配置说明 (默认配置就行)
- 默认配置文件 src/yunpian.ini
- 构造器配置
- `YunpianClient::create($apikey);`
- `YunpianClient::create($apikey,$conf);`
- apikey的优先级 函数的$param[YunpianConstant::APIKEY] > 构造器的$apikey > 构造器的$conf[YunpianConstant::YP_APIKEY] > yunpian.ini
## 源码说明 yunpian-php-sdk
- 工程使用composer构造,php5.6 or higher
- 开发API可参考单元测试 tests/Api
- 执行单元测试 `phpunit tests`,安装[phpunit](https://phpunit.de/manual/5.7/en/installation.html)
## 联系我们
[云片支持 QQ](https://static.meiqia.com/dist/standalone.html?eid=30951&groupid=0d20ab23ab4702939552b3f81978012f&metadata={"name":"github"})
SDK开源QQ群
<img src="doc/sdk_qq.jpeg" width="15%" alt="SDK开源QQ群"/>
## 文档链接
- [api文档](https://www.yunpian.com/api2.0/guide.html)
... ...
{
"name" : "yunpian/yunpian-php-sdk",
"description" : "Yunpian PHP SDK",
"keywords" : [
"yunpian",
"sdk"
],
"license" : "MIT",
"require" : {
"php" : ">=5.6.0",
"guzzlehttp/guzzle" : "~6.0"
},
"config" : {
"preferred-install" : "dist"
},
"homepage" : "https://github.com/yunpian/yunpian-php-sdk",
"support" : {
"issues" : "https://github.com/yunpian/yunpian-php-sdk/issues",
"wiki" : "https://github.com/yunpian/yunpian-php-sdk/wiki",
"source" : "https://github.com/yunpian/yunpian-php-sdk"
},
"require-dev" : {
"phpunit/phpunit" : "~5.7"
},
"authors" : [{
"name" : "dzh",
"email" : "daizhong@yunpian.com",
"role" : "Developer"
}
],
"type" : "library",
"autoload" : {
"psr-4" : {
"Yunpian\\Sdk\\" : "src"
}
},
"autoload-dev" : {
"psr-4" : {
"Yunpian\\Tests\\Sdk\\" : "tests"
}
}
}
\ No newline at end of file
... ...
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "baae71af969886d82b4111969d628aa2",
"packages": [
{
"name": "guzzlehttp/guzzle",
"version": "6.2.3",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/8d6c6cc55186db87b7dc5009827429ba4e9dc006",
"reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006",
"shasum": ""
},
"require": {
"guzzlehttp/promises": "^1.0",
"guzzlehttp/psr7": "^1.4",
"php": ">=5.5"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "^4.0",
"psr/log": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "6.2-dev"
}
},
"autoload": {
"files": [
"src/functions_include.php"
],
"psr-4": {
"GuzzleHttp\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Guzzle is a PHP HTTP client library",
"homepage": "http://guzzlephp.org/",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
"rest",
"web service"
],
"time": "2017-02-28T22:50:30+00:00"
},
{
"name": "guzzlehttp/promises",
"version": "v1.3.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646",
"reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646",
"shasum": ""
},
"require": {
"php": ">=5.5.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Promise\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Guzzle promises library",
"keywords": [
"promise"
],
"time": "2016-12-20T10:07:11+00:00"
},
{
"name": "guzzlehttp/psr7",
"version": "1.4.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "0d6c7ca039329247e4f0f8f8f6506810e8248855"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/0d6c7ca039329247e4f0f8f8f6506810e8248855",
"reference": "0d6c7ca039329247e4f0f8f8f6506810e8248855",
"shasum": ""
},
"require": {
"php": ">=5.4.0",
"psr/http-message": "~1.0"
},
"provide": {
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Psr7\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Tobias Schultze",
"homepage": "https://github.com/Tobion"
}
],
"description": "PSR-7 message implementation that also provides common utility methods",
"keywords": [
"http",
"message",
"request",
"response",
"stream",
"uri",
"url"
],
"time": "2017-02-27T10:51:17+00:00"
},
{
"name": "psr/http-message",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"homepage": "https://github.com/php-fig/http-message",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
],
"time": "2016-08-06T14:39:51+00:00"
}
],
"packages-dev": [
{
"name": "doctrine/instantiator",
"version": "1.0.5",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
"shasum": ""
},
"require": {
"php": ">=5.3,<8.0-DEV"
},
"require-dev": {
"athletic/athletic": "~0.1.8",
"ext-pdo": "*",
"ext-phar": "*",
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "~2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com",
"homepage": "http://ocramius.github.com/"
}
],
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
"homepage": "https://github.com/doctrine/instantiator",
"keywords": [
"constructor",
"instantiate"
],
"time": "2015-06-14T21:17:01+00:00"
},
{
"name": "myclabs/deep-copy",
"version": "1.6.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/5a5a9fc8025a08d8919be87d6884d5a92520cefe",
"reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"doctrine/collections": "1.*",
"phpunit/phpunit": "~4.1"
},
"type": "library",
"autoload": {
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Create deep copies (clones) of your objects",
"homepage": "https://github.com/myclabs/DeepCopy",
"keywords": [
"clone",
"copy",
"duplicate",
"object",
"object graph"
],
"time": "2017-01-26T22:05:40+00:00"
},
{
"name": "phpdocumentor/reflection-common",
"version": "1.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
"reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
"reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
"shasum": ""
},
"require": {
"php": ">=5.5"
},
"require-dev": {
"phpunit/phpunit": "^4.6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jaap van Otterdijk",
"email": "opensource@ijaap.nl"
}
],
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
"homepage": "http://www.phpdoc.org",
"keywords": [
"FQSEN",
"phpDocumentor",
"phpdoc",
"reflection",
"static analysis"
],
"time": "2015-12-27T11:43:31+00:00"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "3.1.1",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e",
"reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e",
"shasum": ""
},
"require": {
"php": ">=5.5",
"phpdocumentor/reflection-common": "^1.0@dev",
"phpdocumentor/type-resolver": "^0.2.0",
"webmozart/assert": "^1.0"
},
"require-dev": {
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^4.4"
},
"type": "library",
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"time": "2016-09-30T07:12:33+00:00"
},
{
"name": "phpdocumentor/type-resolver",
"version": "0.2.1",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb",
"reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb",
"shasum": ""
},
"require": {
"php": ">=5.5",
"phpdocumentor/reflection-common": "^1.0"
},
"require-dev": {
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^5.2||^4.8.24"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"time": "2016-11-25T06:54:22+00:00"
},
{
"name": "phpspec/prophecy",
"version": "v1.7.0",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
"reference": "93d39f1f7f9326d746203c7c056f300f7f126073"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073",
"reference": "93d39f1f7f9326d746203c7c056f300f7f126073",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": "^5.3|^7.0",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2",
"sebastian/comparator": "^1.1|^2.0",
"sebastian/recursion-context": "^1.0|^2.0|^3.0"
},
"require-dev": {
"phpspec/phpspec": "^2.5|^3.2",
"phpunit/phpunit": "^4.8 || ^5.6.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.6.x-dev"
}
},
"autoload": {
"psr-0": {
"Prophecy\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
},
{
"name": "Marcello Duarte",
"email": "marcello.duarte@gmail.com"
}
],
"description": "Highly opinionated mocking framework for PHP 5.3+",
"homepage": "https://github.com/phpspec/prophecy",
"keywords": [
"Double",
"Dummy",
"fake",
"mock",
"spy",
"stub"
],
"time": "2017-03-02T20:05:34+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "4.0.7",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "09e2277d14ea467e5a984010f501343ef29ffc69"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/09e2277d14ea467e5a984010f501343ef29ffc69",
"reference": "09e2277d14ea467e5a984010f501343ef29ffc69",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-xmlwriter": "*",
"php": "^5.6 || ^7.0",
"phpunit/php-file-iterator": "^1.3",
"phpunit/php-text-template": "^1.2",
"phpunit/php-token-stream": "^1.4.2 || ^2.0",
"sebastian/code-unit-reverse-lookup": "^1.0",
"sebastian/environment": "^1.3.2 || ^2.0",
"sebastian/version": "^1.0 || ^2.0"
},
"require-dev": {
"ext-xdebug": "^2.1.4",
"phpunit/phpunit": "^5.7"
},
"suggest": {
"ext-xdebug": "^2.5.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
"keywords": [
"coverage",
"testing",
"xunit"
],
"time": "2017-03-01T09:12:17+00:00"
},
{
"name": "phpunit/php-file-iterator",
"version": "1.4.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
"reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
"homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
"keywords": [
"filesystem",
"iterator"
],
"time": "2016-10-03T07:40:28+00:00"
},
{
"name": "phpunit/php-text-template",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-text-template.git",
"reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
"reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Simple template engine.",
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
"keywords": [
"template"
],
"time": "2015-06-21T13:50:34+00:00"
},
{
"name": "phpunit/php-timer",
"version": "1.0.9",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
"reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f",
"reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Utility class for timing",
"homepage": "https://github.com/sebastianbergmann/php-timer/",
"keywords": [
"timer"
],
"time": "2017-02-26T11:10:40+00:00"
},
{
"name": "phpunit/php-token-stream",
"version": "1.4.11",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7",
"reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Wrapper around PHP's tokenizer extension.",
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
"keywords": [
"tokenizer"
],
"time": "2017-02-27T10:12:30+00:00"
},
{
"name": "phpunit/phpunit",
"version": "5.7.15",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "b99112aecc01f62acf3d81a3f59646700a1849e5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b99112aecc01f62acf3d81a3f59646700a1849e5",
"reference": "b99112aecc01f62acf3d81a3f59646700a1849e5",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-xml": "*",
"myclabs/deep-copy": "~1.3",
"php": "^5.6 || ^7.0",
"phpspec/prophecy": "^1.6.2",
"phpunit/php-code-coverage": "^4.0.4",
"phpunit/php-file-iterator": "~1.4",
"phpunit/php-text-template": "~1.2",
"phpunit/php-timer": "^1.0.6",
"phpunit/phpunit-mock-objects": "^3.2",
"sebastian/comparator": "^1.2.4",
"sebastian/diff": "~1.2",
"sebastian/environment": "^1.3.4 || ^2.0",
"sebastian/exporter": "~2.0",
"sebastian/global-state": "^1.1",
"sebastian/object-enumerator": "~2.0",
"sebastian/resource-operations": "~1.0",
"sebastian/version": "~1.0.3|~2.0",
"symfony/yaml": "~2.1|~3.0"
},
"conflict": {
"phpdocumentor/reflection-docblock": "3.0.2"
},
"require-dev": {
"ext-pdo": "*"
},
"suggest": {
"ext-xdebug": "*",
"phpunit/php-invoker": "~1.1"
},
"bin": [
"phpunit"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.7.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "The PHP Unit Testing framework.",
"homepage": "https://phpunit.de/",
"keywords": [
"phpunit",
"testing",
"xunit"
],
"time": "2017-03-02T15:22:43+00:00"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "3.4.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3ab72b65b39b491e0c011e2e09bb2206c2aa8e24",
"reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": "^5.6 || ^7.0",
"phpunit/php-text-template": "^1.2",
"sebastian/exporter": "^1.2 || ^2.0"
},
"conflict": {
"phpunit/phpunit": "<5.4.0"
},
"require-dev": {
"phpunit/phpunit": "^5.4"
},
"suggest": {
"ext-soap": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Mock Object library for PHPUnit",
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
"keywords": [
"mock",
"xunit"
],
"time": "2016-12-08T20:27:08+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git",
"reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18",
"reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18",
"shasum": ""
},
"require": {
"php": "^5.6 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7 || ^6.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Looks up which function or method a line of code belongs to",
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
"time": "2017-03-04T06:30:41+00:00"
},
{
"name": "sebastian/comparator",
"version": "1.2.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
"reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"sebastian/diff": "~1.2",
"sebastian/exporter": "~1.2 || ~2.0"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@2bepublished.at"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides the functionality to compare PHP values for equality",
"homepage": "http://www.github.com/sebastianbergmann/comparator",
"keywords": [
"comparator",
"compare",
"equality"
],
"time": "2017-01-29T09:50:25+00:00"
},
{
"name": "sebastian/diff",
"version": "1.4.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "13edfd8706462032c2f52b4b862974dd46b71c9e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e",
"reference": "13edfd8706462032c2f52b4b862974dd46b71c9e",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Kore Nordmann",
"email": "mail@kore-nordmann.de"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Diff implementation",
"homepage": "https://github.com/sebastianbergmann/diff",
"keywords": [
"diff"
],
"time": "2015-12-08T07:14:41+00:00"
},
{
"name": "sebastian/environment",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac",
"reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac",
"shasum": ""
},
"require": {
"php": "^5.6 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^5.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides functionality to handle HHVM/PHP environments",
"homepage": "http://www.github.com/sebastianbergmann/environment",
"keywords": [
"Xdebug",
"environment",
"hhvm"
],
"time": "2016-11-26T07:53:53+00:00"
},
{
"name": "sebastian/exporter",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4",
"reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"sebastian/recursion-context": "~2.0"
},
"require-dev": {
"ext-mbstring": "*",
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@2bepublished.at"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net"
}
],
"description": "Provides the functionality to export PHP variables for visualization",
"homepage": "http://www.github.com/sebastianbergmann/exporter",
"keywords": [
"export",
"exporter"
],
"time": "2016-11-19T08:54:04+00:00"
},
{
"name": "sebastian/global-state",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"suggest": {
"ext-uopz": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Snapshotting of global state",
"homepage": "http://www.github.com/sebastianbergmann/global-state",
"keywords": [
"global state"
],
"time": "2015-10-12T03:26:01+00:00"
},
{
"name": "sebastian/object-enumerator",
"version": "2.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/object-enumerator.git",
"reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7",
"reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7",
"shasum": ""
},
"require": {
"php": ">=5.6",
"sebastian/recursion-context": "~2.0"
},
"require-dev": {
"phpunit/phpunit": "~5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
"time": "2017-02-18T15:18:39+00:00"
},
{
"name": "sebastian/recursion-context",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/recursion-context.git",
"reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a",
"reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net"
}
],
"description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"time": "2016-11-19T07:33:16+00:00"
},
{
"name": "sebastian/resource-operations",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/resource-operations.git",
"reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52",
"reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52",
"shasum": ""
},
"require": {
"php": ">=5.6.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides a list of PHP built-in functions that operate on resources",
"homepage": "https://www.github.com/sebastianbergmann/resource-operations",
"time": "2015-07-28T20:34:47+00:00"
},
{
"name": "sebastian/version",
"version": "2.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
"reference": "99732be0ddb3361e16ad77b68ba41efc8e979019"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019",
"reference": "99732be0ddb3361e16ad77b68ba41efc8e979019",
"shasum": ""
},
"require": {
"php": ">=5.6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
"time": "2016-10-03T07:35:21+00:00"
},
{
"name": "symfony/yaml",
"version": "v3.2.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "093e416ad096355149e265ea2e4cc1f9ee40ab1a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/093e416ad096355149e265ea2e4cc1f9ee40ab1a",
"reference": "093e416ad096355149e265ea2e4cc1f9ee40ab1a",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"require-dev": {
"symfony/console": "~2.8|~3.0"
},
"suggest": {
"symfony/console": "For validating YAML files using the lint command"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2017-03-07T16:47:02+00:00"
},
{
"name": "webmozart/assert",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/webmozart/assert.git",
"reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f",
"reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.6",
"sebastian/version": "^1.0.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
},
"autoload": {
"psr-4": {
"Webmozart\\Assert\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bernhard Schussek",
"email": "bschussek@gmail.com"
}
],
"description": "Assertions to validate method input/output with nice error messages.",
"keywords": [
"assert",
"check",
"validate"
],
"time": "2016-11-23T20:04:58+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.6.0"
},
"platform-dev": []
}
... ...
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles>
<profile name="PHP Conventions [built-in]-dzh">
<setting id="indentationChar" value=" "/>
<setting id="insert_space_after_opening_paren_in_declare" value="false"/>
<setting id="insert_space_before_closing_paren_in_declare" value="false"/>
<setting id="insert_space_before_opening_paren_in_declare" value="false"/>
<setting id="org.eclipse.php.core.formatter.insert_new_line_in_function_invoke" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_line_wrap_policy" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_assignment_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_assignment_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_assignment_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_line_wrap_policy" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_force_split" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_line_wrap_policy" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_line_wrap_policy" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_before_field" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_before_member_type" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_before_method" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_between_type_declarations" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_block" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_lambda_function_declaration" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_method_declaration" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_switch" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_type_declaration" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_block_comments" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_header" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_html" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_javadoc_comments" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_line_comments" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_source_code" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.indent_parameter_description" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.indent_root_tags" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.insert_new_line_before_root_tags" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.insert_new_line_for_parameter" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.line_length" value="120"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.continuation_indentation" value="2"/>
<setting id="org.eclipse.php.formatter.core.formatter.continuation_indentation_for_array_initializer" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.php.formatter.core.formatter.enabling_tag" value="@formatter:on"/>
<setting id="org.eclipse.php.formatter.core.formatter.format_guardian_clause_on_one_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_breaks_compare_to_cases" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_empty_lines" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_statements_compare_to_block" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_statements_compare_to_body" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indentation.size" value="4"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_catch_in_try_statement" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_else_in_if_statement" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_finally_in_try_statement" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_while_in_do_statement" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_block" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_method_body" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_type_declaration" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_array_creation" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_field_access" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_foreach" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_yield" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_assignment_operator" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_binary_operator" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_closing_brace_in_block" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_closing_paren_in_cast" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_colon_in_conditional" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_coloncolon_in_field_access" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_coloncolon_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_array_creation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_echo" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_for_inits" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_global" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_list" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_multiple_constant_declarations" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_static" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_superinterfaces" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_array_creation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_cast" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_catch" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_for" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_foreach" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_if" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_list" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_switch" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_while" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_postfix_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_prefix_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_question_in_conditional" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_semicolon_in_for" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_unary_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_array_creation" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_field_access" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_foreach" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_yield" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_assignment_operator" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_binary_operator" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_array_creation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_cast" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_catch" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_for" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_foreach" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_if" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_list" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_switch" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_while" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_case" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_conditional" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_default" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_coloncolon_in_field_access" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_coloncolon_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_array_creation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_echo" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_for_inits" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_global" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_list" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_multiple_constant_declarations" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_static" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_superinterfaces" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_block" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_switch" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_array_creation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_catch" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_for" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_foreach" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_if" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_list" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_switch" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_while" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_postfix_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_prefix_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_question_in_conditional" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_semicolon" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_semicolon_in_for" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_unary_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_between_brackets_in_array_type_reference" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.join_lines_in_comments" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_elseif_statement_on_same_line" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_imple_if_on_one_line" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_then_statement_on_same_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.lineSplit" value="120"/>
<setting id="org.eclipse.php.formatter.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_after_namespace" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_after_use_statements" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_end_of_class_body" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_before_namespace" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_before_use_statements" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_between_namespaces" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_between_use_statements" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.put_empty_statement_on_new_line" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.php.formatter.core.formatter.use_on_off_tags" value="false"/>
</profile>
</profiles>
... ...
# sdk配置
## 默认配置
## 自定义配置
## 配置优先级
# sdk使用
# 源码工程
... ...
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="true" backupStaticAttributes="false" bootstrap="vendor/autoload.php"
cacheTokens="false" colors="false" convertErrorsToExceptions="true"
convertNoticesToExceptions="true" convertWarningsToExceptions="true"
forceCoversAnnotation="false" mapTestClassNameToCoveredClassName="false"
printerClass="PHPUnit_TextUI_ResultPrinter" processIsolation="false"
stopOnError="false" stopOnFailure="false" stopOnIncomplete="false"
stopOnSkipped="false" stopOnRisky="false"
testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader"
timeoutForSmallTests="1" timeoutForMediumTests="10"
timeoutForLargeTests="60" verbose="false">
<!--printerFile="/path/to/ResultPrinter.php" -->
<!--testSuiteLoaderFile="/path/to/StandardTestSuiteLoader.php" -->
<!-- xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.7/phpunit.xsd" -->
<testsuites>
<testsuit name="YunpianApiTestSuit">
<directory suffix="Test.php">tests</directory>
</testsuit>
</testsuites>
<filter>
<whitelist>
<directory>src</directory>
</whitelist>
</filter>
</phpunit>
... ...
<?php
namespace Yunpian\Sdk\Api;
/**
*
* @author dzh
* @since 1.0
*/
class ApiFactory {
private $clnt;
function __construct($clnt) {
$this->clnt = $clnt;
}
function api($name) {
$api = null;
switch ($name) {
case FlowApi::NAME:
$api = new FlowApi();
break;
case SignApi::NAME:
$api = new SignApi();
break;
case SmsApi::NAME:
$api = new SmsApi();
break;
case TplApi::NAME:
$api = new TplApi();
break;
case UserApi::NAME:
$api = new UserApi();
break;
case VoiceApi::NAME:
$api = new VoiceApi();
break;
default:
$api = new VoidApi();
}
$api->init($this->clnt);
return $api;
}
}
... ...
<?php
namespace Yunpian\Sdk\Api;
use Yunpian\Sdk\Model\Result;
use Yunpian\Sdk\YunpianClient;
/**
* https://www.yunpian.com/api2.0/api-flow.html
*
* @author dzh
* @since 1.0
*/
class FlowApi extends YunpianApi {
const NAME = "flow";
function init(YunpianClient $clnt) {
parent::init($clnt);
$this->host($clnt->conf(self::YP_FLOW_HOST, 'https://flow.yunpian.com'));
}
function name() {
return self::NAME;
}
/**
* <h1>查询流量包</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* carrier String 否 运营商ID 传入该参数则获取指定运营商的流量包, 否则获取所有运营商的流量包 移动:10086 联通:10010
* 电信:10000
* </p>
*
* @param array $param
* @return Result
*
*/
function get_package(array $param = []) {
static $must = [self::APIKEY];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::FLOW_PACKAGE];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('get_package.json')->post($param, $h, $r);
}
/**
* <h1>充值流量</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* mobile String 是 接收的手机号(仅支持大陆号码) 15205201314
* </p>
* <p>
* sn String 是 流量包的唯一ID 点击查看 1008601
* </p>
* <p>
* callback_url String 否 本条流量充值的状态报告推送地址 http://your_receive_url_address
* </p>
* <p>
* encrypt String 否 加密方式 使用加密 tea (不再使用)
* </p>
* <p>
* _sign String 否 签名字段 参考使用加密 393d079e0a00912335adfe46f4a2e10f (不再使用)
* </p>
*
* @param array $param
* @return Result
*
*/
function recharge(array $param = []) {
static $must = [self::APIKEY,self::MOBILE];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::RESULT];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('recharge.json')->post($param, $h, $r);
}
/**
* <h1>获取状态报告</h1>
*
* <p>
* 参数名 是否必须 描述 示例
* </p>
* <p>
* apikey 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* page_size 否 每页个数,最大100个,默认20个 20
* </p>
*
* @param array $param
* @return Result
*
*/
function pull_status(array $param = []) {
static $must = [self::APIKEY];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::FLOW_STATUS];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('pull_status.json')->post($param, $h, $r);
}
}
\ No newline at end of file
... ...
<?php
namespace Yunpian\Sdk\Api;
use Yunpian\Sdk\Model\Result;
use Yunpian\Sdk\YunpianClient;
/**
* https://www.yunpian.com/api2.0/sign.html
*
* @author dzh
* @since 1.0
*/
class SignApi extends YunpianApi {
const NAME = "sign";
function init(YunpianClient $clnt) {
parent::init($clnt);
$this->host($clnt->conf(self::YP_SIGN_HOST, 'https://sms.yunpian.com'));
}
function name() {
return self::NAME;
}
/**
* <h1>添加签名API</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* sign String 是 签名内容 云片网
* </p>
* <p>
* notify Boolean 否 是否短信通知结果,默认true true
* </p>
* <p>
* apply_vip Boolean 否 是否申请专用通道,默认false false
* </p>
* <p>
* is_only_global Boolean 否 是否仅发国际短信,默认false false
* </p>
* <p>
* industry_type String 否 所属行业,默认“其它” 物联网 其他值例如:1. 游戏 2. 移动应用 3. 视频 4. 教育 5.
* IT/通信/电子服务 6. 电子商务 7. 金融 8. 网站 9. 商业服务 10. 房地产/建筑 11. 零售/租赁/贸易 12.
* 生产/加工/制造 13. 交通/物流 14. 文化传媒 15. 能源/电气 16. 政府企业 17. 农业 18. 物联网 19. 其它
* </p>
*
* @param array $param
* sign notify apply_vip is_only_global industry_type
* @return Result
*/
function add(array $param = []) {
static $must = [self::APIKEY,self::SIGN];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V2:
return $rsp[self::SIGN];
}
return null;
});
return $this->path('add.json')->post($param, $h, $r);
}
/**
* <h1>修改签名API</h1>
* <p>
* 仅“审核中”或者“审核失败”的签名可以进行修改,修改后会重新提交给客服审核。
* </p>
* <p>
* 参数notify,apply_vip,is_only_global如果没有将会修改为默认值
* </p>
*
* <p>
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* old_sign String 是 完整签名内容,用于指定修改哪个签名,可以加【】也可不加 云片网
* </p>
* <p>
* sign String 否 修改后的签名内容(如果要改签名内容) 云片网
* </p>
* <p>
* notify Boolean 否 是否短信通知结果,无此参数默认true true
* </p>
* <p>
* apply_vip Boolean 否 是否申请专用通道,无此参数默认false false
* </p>
* <p>
* is_only_global Boolean 否 是否仅发国际短信,无此参数默认false false
* </p>
* <p>
* industry_type String 否 所属行业,默认“其它” 物联网 其他值例如:1. 游戏 2. 移动应用 3. 视频 4. 教育 5.
* IT/通信/电子服务 6. 电子商务 7. 金融 8. 网站 9. 商业服务 10. 房地产/建筑 11. 零售/租赁/贸易 12.
* 生产/加工/制造 13. 交通/物流 14. 文化传媒 15. 能源/电气 16. 政府企业 17. 农业 18. 物联网 19. 其它
* </p>
*
* @param array $param
* old_sign sign notify apply_vip is_only_global industry_type
* @return Result
*/
function update(array $param) {
static $must = [self::APIKEY,self::OLD_SIGN];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V2:
return $rsp[self::SIGN];
}
return null;
});
return $this->path('update.json')->post($param, $h, $r);
}
/**
* <h1>获取签名API</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* id Long 否 签名id,暂未开放,如果传入此参数将会指定获取某个签名 9527
* </p>
* <p>
* sign String 否 签名内容 云片网
* </p>
* <p>
* page_num Integer 否 页码,1开始,不带或者格式错误返回全部 1
* </p>
* <p>
* page_size Integer 否 返回条数,必须大于0,不带或者格式错误返回全部 20
* </p>
*
* @param array $param
* sign notify page_num page_size
* @return Result
*/
function get(array $param) {
static $must = [self::APIKEY];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V2:
return $rsp[self::SIGN];
}
return null;
});
return $this->path('get.json')->post($param, $h, $r);
}
}
\ No newline at end of file
... ...
<?php
namespace Yunpian\Sdk\Api;
use Yunpian\Sdk\Model\Result;
use Yunpian\Sdk\YunpianClient;
/**
* https://www.yunpian.com/api2.0/sms.html
*
* @author dzh
* @since 1.0
*/
class SmsApi extends YunpianApi {
const NAME = "sms";
function init(YunpianClient $clnt) {
parent::init($clnt);
$this->host($clnt->conf(self::YP_SMS_HOST, 'https://sms.yunpian.com'));
}
function name() {
return self::NAME;
}
/**
* <h1>智能匹配模板发送 only v1</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* mobile String 是 接收的手机号;发送多个手机号请以逗号分隔,一次不要超过1000个
* 国际短信仅支持单号码发送,国际号码需包含国际地区前缀号码,格式必须是"+"号开头("+"号需要urlencode处理,否则会出现格式错误),国际号码不以"+"开头将被认为是中国地区的号码
* (针对国际短信,mobile参数会自动格式化到E.164格式,可能会造成传入mobile参数跟后续的状态报告中的号码不一致。E.164格式说明,参见:
* https://en.wikipedia.org/wiki/E.164) 单号码:15205201314
* 多号码:15205201314,15205201315 国际短信:+93701234567
* </p>
* <p>
* text String 是 短信内容 【云片网】您的验证码是1234
* </p>
* <p>
* extend String 否 扩展号。默认不开放,如有需要请联系客服申请 001
* </p>
* <p>
* uid String 否 该条短信在您业务系统内的ID,比如订单号或者短信发送记录的流水号。填写后发送状态返回值内将包含这个ID
* 默认不开放,如有需要请联系客服申请 10001
* </p>
* <p>
* callback_url String 否
* 本条短信状态报告推送地址。短信发送后将向这个地址推送短信发送报告。"后台-系统设置-数据推送与获取”可以做批量设置。如果后台已经设置地址的情况下,单次请求内也包含此参数,将以请求内的推送地址为准。
* </p>
*
* @deprecated
*
* @param array $param
* @return Result
*/
function send(array $param) {
static $must = [self::APIKEY,self::MOBILE,self::TEXT];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::RESULT];
}
return null;
});
return $this->path('send.json')->post($param, $h, $r);
}
/**
* <h1>单条发送</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* mobile String 是
* 接收的手机号;仅支持单号码发送;国际号码需包含国际地区前缀号码,格式必须是"+"号开头("+"号需要urlencode处理,否则会出现格式错误),国际号码不以"+"开头将被认为是中国地区的号码
* (针对国际短信,mobile参数会自动格式化到E.164格式,可能会造成传入mobile参数跟后续的状态报告中的号码不一致。E.164格式说明,参见:
* https://en.wikipedia.org/wiki/E.164) 国内号码:15205201314
* 国际号码:urlencode("+93701234567");
* </p>
* <p>
* text String 是 短信内容 【云片网】您的验证码是1234
* </p>
* <p>
* extend String 否 扩展号。默认不开放,如有需要请联系客服申请 001
* </p>
* <p>
* uid String 否 该条短信在您业务系统内的ID,比如订单号或者短信发送记录的流水号。填写后发送状态返回值内将包含这个ID
* 默认不开放,如有需要请联系客服申请 10001
* </p>
* <p>
* callback_url String 否
* 本条短信状态报告推送地址。短信发送后将向这个地址推送短信发送报告。"后台-系统设置-数据推送与获取”可以做批量设置。如果后台已经设置地址的情况下,单次请求内也包含此参数,将以请求内的推送地址为准。
* http://your_receive_url_address
* </p>
*
* @param array $param
* @return Result
*/
function single_send(array $param) {
static $must = [self::APIKEY,self::MOBILE,self::TEXT];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('single_send.json')->post($param, $h, $r);
}
/**
* <h1>批量发送</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* mobile String 是 接收的手机号;发送多个手机号请以逗号分隔,一次不要超过1000个。 单号码:15205201314
* 多号码:15205201314,15205201315
* </p>
* <p>
* text String 是 短信内容 【云片网】您的验证码是1234
* </p>
* <p>
* extend String 否 扩展号。默认不开放,如有需要请联系客服申请 001
* </p>
* <p>
* uid String 否 该条短信在您业务系统内的ID,比如订单号或者短信发送记录的流水号。填写后发送状态返回值内将包含这个ID
* 默认不开放,如有需要请联系客服申请 10001
* </p>
* <p>
* callback_url String 否
* 本条短信状态报告推送地址。短信发送后将向这个地址推送短信发送报告。"后台-系统设置-数据推送与获取”可以做批量设置。如果后台已经设置地址的情况下,单次请求内也包含此参数,将以请求内的推送地址为准。
* http://your_receive_url_address
* </p>
*
* @param array $param
* @return Result
*/
function batch_send(array $param) {
static $must = [self::APIKEY,self::MOBILE,self::TEXT];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('batch_send.json')->post($param, $h, $r);
}
/**
* <h1>个性化发送</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* mobile String 是
* 接收的手机号;多个手机号请以逗号分隔,一次不要超过1000个且手机号个数必须与短信内容条数相等;不支持国际号码发送;
* 多号码:15205201314,15205201315
* </p>
* <p>
* text String 是
* 短信内容,多个短信内容请使用UTF-8做urlencode后,使用逗号分隔,一次不要超过1000条且短信内容条数必须与手机号个数相等
* 内容示意:UrlEncode("【云片网】您的验证码是1234", "UTF-8") + "," +
* UrlEncode("【云片网】您的验证码是5678", "UTF-8")
* </p>
* <p>
* extend String 否 扩展号。默认不开放,如有需要请联系客服申请 001
* </p>
* <p>
* uid String 否 该条短信在您业务系统内的ID,比如订单号或者短信发送记录的流水号。填写后发送状态返回值内将包含这个ID
* 默认不开放,如有需要请联系客服申请 10001
* </p>
* <p>
* callback_url String 否
* 本条短信状态报告推送地址。短信发送后将向这个地址推送短信发送报告。"后台-系统设置-数据推送与获取”可以做批量设置。如果后台已经设置地址的情况下,单次请求内也包含此参数,将以请求内的推送地址为准。
* http://your_receive_url_address
* </p>
*
* @param array $param
* @return Result
*/
function multi_send(array $param) {
static $must = [self::APIKEY,self::MOBILE,self::TEXT];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp;
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('multi_send.json')->post($param, $h, $r);
}
/**
* <h1>获取状态报告</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* page_size Integer 否 每页个数,最大100个,默认20个 20
* </p>
*
* @param array $param
* @return Result
*/
function pull_status(array $param) {
static $must = [self::APIKEY];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::SMS_STATUS];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('pull_status.json')->post($param, $h, $r);
}
/**
* <h1>获取回复短信</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* page_size Integer 否 每页个数,最大100个,默认20个 20
* </p>
*
* @param array $param
* @return Result
*/
function pull_reply(array $param) {
static $must = [self::APIKEY];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::SMS_REPLY];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('pull_reply.json')->post($param, $h, $r);
}
/**
* <h1>查回复的短信</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* start_time String 是 短信回复开始时间 2013-08-11 00:00:00
* </p>
* <p>
* end_time String 是 短信回复结束时间 2013-08-12 00:00:00
* </p>
* <p>
* page_num Integer 是 页码,默认值为1 1
* </p>
* <p>
* page_size Integer 是 每页个数,最大100个 20
* </p>
* <p>
* mobile String 否 填写时只查该手机号的回复,不填时查所有的回复 15205201314
* </p>
* <p>
* return_fields 否 返回字段(暂未开放
* </p>
* <p>
* sort_fields 否 排序字段(暂未开放) 默认按提交时间降序
* </p>
*
* @param array $param
* @return Result
*/
function get_reply(array $param) {
static $must = [self::APIKEY,self::START_TIME,self::END_TIME,self::PAGE_NUM,self::PAGE_SIZE];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::SMS_REPLY];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('get_reply.json')->post($param, $h, $r);
}
/**
* <h1>查屏蔽词</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* text String 是 要检查的短信模板或者内容 这是一条测试短信
* </p>
*
* @param array $param
* @return Result
*/
function get_black_word(array $param) {
static $must = [self::APIKEY,self::TEXT];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::RESULT];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('get_black_word.json')->post($param, $h, $r);
}
/**
* <h1>查短信发送记录</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* mobile String 否 需要查询的手机号 15205201314
* </p>
* <p>
* start_time String 是 短信发送开始时间 2013-08-11 00:00:00
* </p>
* <p>
* end_time String 是 短信发送结束时间 2013-08-12 00:00:00
* </p>
* <p>
* page_num Integer 否 页码,默认值为1 1
* </p>
* <p>
* page_size Integer 否 每页个数,最大100个 20
* </p>
*
* @param array $param
* @return Result
*/
function get_record(array $param) {
static $must = [self::APIKEY,self::START_TIME,self::END_TIME];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::SMS];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('get_record.json')->post($param, $h, $r);
}
/**
* <h1>统计短信条数</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* start_time String 是 短信发送开始时间 2013-08-11 00:00:00
* </p>
* <p>
* end_time String 是 短信发送结束时间 2013-08-12 00:00:00
* </p>
* <p>
* mobile String 否 需要查询的手机号 15205201314
* </p>
* <p>
* page_num Integer 否 页码,默认值为1 1
* </p>
* <p>
* page_size Integer 否 每页个数,最大100个 20
* </p>
*
* @param array $param
* @return Result
*/
function count(array $param) {
static $must = [self::APIKEY,self::START_TIME,self::END_TIME];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
$total = $rsp[self::TOTAL];
return is_null($total) ? 0 : $total;
});
return $this->path('count.json')->post($param, $h, $r);
}
/**
* <h1>指定模板发送 only v1</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* mobile String 是 接收的手机号 15205201314
* </p>
* <p>
* tpl_id Long 是 模板id 1
* </p>
* <p>
* tpl_value String 是 变量名和变量值对。请先对您的变量名和变量值分别进行urlencode再传递。使用参考:代码示例。
* 注:变量名和变量值都不能为空 模板: 【#company#】您的验证码是#code#。 最终发送结果: 【云片网】您的验证码是1234。
* tplvalue=urlencode("#code#") + "=" + urlencode("1234") + "&amp;" +
* urlencode("#company#") + "=" + urlencode("云片网"); 若您直接发送报文请求则使用下面这种形式
* tplvalue=urlencode(urlencode("#code#") + "=" + urlencode("1234") + "&amp;" +
* urlencode("#company#") + "=" + urlencode("云片网"));
* </p>
* <p>
* extend String 否 扩展号。默认不开放,如有需要请联系客服申请 001
* </p>
* <p>
* uid String 否 用户自定义唯一id。最大长度不超过256的字符串。 默认不开放,如有需要请联系客服申请 10001
* </p>
*
* @deprecated
*
* @param array $param
* @return Result
*/
function tpl_send(array $param) {
static $must = [self::APIKEY,self::MOBILE,self::TPL_ID,self::TPL_VALUE];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::RESULT];
}
return null;
});
return $this->path('tpl_send.json')->post($param, $h, $r);
}
/**
* <h1>指定模板单发 only v2</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* mobile String 是
* 接收的手机号(针对国际短信,mobile参数会自动格式化到E.164格式,可能会造成传入mobile参数跟后续的状态报告中的号码不一致。E.164格式说明,参见:
* https://en.wikipedia.org/wiki/E.164) 15205201314
* </p>
* <p>
* tpl_id Long 是 模板id 1
* </p>
* <p>
* tpl_value String 是 变量名和变量值对。请先对您的变量名和变量值分别进行urlencode再传递。使用参考:代码示例。
* 注:变量名和变量值都不能为空 模板: 【#company#】您的验证码是#code#。 最终发送结果: 【云片网】您的验证码是1234。
* tplvalue=urlencode("#code#") + "=" + urlencode("1234") + "&amp;" +
* urlencode("#company#") + "=" + urlencode("云片网"); 若您直接发送报文请求则使用下面这种形式
* tplvalue=urlencode(urlencode("#code#") + "=" + urlencode("1234") + "&amp;" +
* urlencode("#company#") + "=" + urlencode("云片网"));
* </p>
* <p>
* extend String 否 扩展号。默认不开放,如有需要请联系客服申请 001
* </p>
* <p>
* uid String 否 用户自定义唯一id。最大长度不超过256的字符串。 默认不开放,如有需要请联系客服申请 10001
* </p>
*
* @deprecated
*
* @param array $param
* @return Result
*/
function tpl_single_send(array $param) {
static $must = [self::APIKEY,self::MOBILE,self::TPL_ID,self::TPL_VALUE];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('tpl_single_send.json')->post($param, $h, $r);
}
/**
* <h1>指定模板群发 only v2</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* mobile String 是
* 接收的手机号(针对国际短信,mobile参数会自动格式化到E.164格式,可能会造成传入mobile参数跟后续的状态报告中的号码不一致。E.164格式说明,参见:
* https://en.wikipedia.org/wiki/E.164) 15205201314
* </p>
* <p>
* tpl_id Long 是 模板id 1
* </p>
* <p>
* tpl_value String 是 变量名和变量值对。请先对您的变量名和变量值分别进行urlencode再传递。使用参考:代码示例。
* 注:变量名和变量值都不能为空 模板: 【#company#】您的验证码是#code#。 最终发送结果: 【云片网】您的验证码是1234。
* tplvalue=urlencode("#code#") + "=" + urlencode("1234") + "&amp;" +
* urlencode("#company#") + "=" + urlencode("云片网"); 若您直接发送报文请求则使用下面这种形式
* tplvalue=urlencode(urlencode("#code#") + "=" + urlencode("1234") + "&amp;" +
* urlencode("#company#") + "=" + urlencode("云片网"));
* </p>
* <p>
* extend String 否 扩展号。默认不开放,如有需要请联系客服申请 001
* </p>
* <p>
* uid String 否 用户自定义唯一id。最大长度不超过256的字符串。 默认不开放,如有需要请联系客服申请 10001
* </p>
*
* @deprecated
*
* @param array $param
* @return Result
*/
function tpl_batch_send(array $param) {
static $must = [self::APIKEY,self::MOBILE,self::TPL_ID,self::TPL_VALUE];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('tpl_batch_send.json')->post($param, $h, $r);
}
}
... ...
<?php
namespace Yunpian\Sdk\Api;
use Yunpian\Sdk\Model\Result;
use Yunpian\Sdk\YunpianClient;
/**
* https://www.yunpian.com/api2.0/tpl.html
*
* @author dzh
* @since 1.0
*/
class TplApi extends YunpianApi {
const NAME = "tpl";
function init(YunpianClient $clnt) {
parent::init($clnt);
$this->host($clnt->conf(self::YP_TPL_HOST, 'https://sms.yunpian.com'));
}
function name() {
return self::NAME;
}
/**
* <h1>取默认模板</h1>
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* tpl_id Long 否 模板id,64位长整形。指定id时返回id对应的默认 模板。未指定时返回所有默认模板 1
* </p>
*
* @param array $param
* tpl_id
* @return
*
*/
function get_default(array $param) {
static $must = [self::APIKEY];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path("get_default.json")->post($param, $h, $r);
}
/**
* <h1>取模板</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* tpl_id Long 否 模板id,64位长整形。指定id时返回id对应的 模板。未指定时返回所有模板 1
* </p>
*
* @param array $param
* tpl_id
* @return Result
*/
function get(array $param) {
static $must = [self::APIKEY];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::TEMPLATE];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path("get.json")->post($param, $h, $r);
}
/**
* <h1>添加模板</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* tpl_content String 是 模板内容,必须以带符号【】的签名开头 【云片网】您的验证码是#code#
* </p>
* <p>
* notify_type Integer 否 审核结果短信通知的方式: 0表示需要通知,默认; 1表示仅审核不通过时通知; 2表示仅审核通过时通知;
* 3表示不需要通知 1
* </p>
* <p>
* lang String 否 国际短信模板所需参数,模板语言:简体中文zh_cn; 英文en; 繁体中文 zh_tw; 韩文ko,日文 ja
* zh_cn
* </p>
*
* @param array $param
* @return Result
*/
function add(array $param) {
static $must = [self::APIKEY,self::TPL_CONTENT];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::TEMPLATE];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path("add.json")->post($param, $h, $r);
}
/**
* <h1>删除模板</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* tpl_id Long 是 模板id,64位长整形 9527
* </p>
*
* @param array $param
* @return Result
*/
function del(array $param) {
static $must = [self::APIKEY,self::TPL_ID];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path("del.json")->post($param, $h, $r);
}
/**
* <h1>修改模板</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* tpl_id Long 是 模板id,64位长整形,指定id时返回id对应的模板。未指定时返回所有模板 9527
* </p>
* <p>
* tpl_content String 是
* 模板id,64位长整形。指定id时返回id对应的模板。未指定时返回所有模板模板内容,必须以带符号【】的签名开头 【云片网】您的验证码是#code#
* </p>
* <p>
* notify_type Integer 否 审核结果短信通知的方式: 0表示需要通知,默认; 1表示仅审核不通过时通知; 2表示仅审核通过时通知;
* 3表示不需要通知 1
* </p>
* <p>
* lang String 否 国际短信模板所需参数,模板语言:简体 中文zh_cn; 英文en; 繁体中文 zh_tw; 韩文ko,日文 ja
* zh_cn
* </p>
*
* @param array $param
* @return Result
*
*/
function update(array $param) {
static $must = [self::APIKEY,self::TPL_ID,self::TPL_CONTENT];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::TEMPLATE];
case self::VERSION_V2:
return $rsp[self::TEMPLATE];
}
return null;
});
return $this->path("update.json")->post($param, $h, $r);
}
}
\ No newline at end of file
... ...
<?php
namespace Yunpian\Sdk\Api;
use Yunpian\Sdk\Model\Result;
use Yunpian\Sdk\YunpianClient;
/**
* https://www.yunpian.com/api2.0/user.html
*
* @author dzh
* @since 1.0
*/
class UserApi extends YunpianApi {
const NAME = "user";
function init(YunpianClient $clnt) {
parent::init($clnt);
$this->host($clnt->conf(self::YP_USER_HOST, 'https://sms.yunpian.com'));
}
function name() {
return self::NAME;
}
/**
* <h1>查账户信息</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
*
* @return Result
*
*/
function get($param = []) {
static $must = [self::APIKEY];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::USER];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('get.json')->post($param, $h, $r);
}
/**
* <h1>修改账户信息</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* emergency_contact String 否 紧急联系人 zhangshan
* </p>
* <p>
* emergency_mobile String 否 紧急联系人手机号 13012345678
* </p>
* <p>
* alarm_balance Long 否 短信余额提醒阈值。 一天只提示一次 100
* </p>
*
* @param array $param
* emergency_contact emergency_mobile alarm_balance
* @return Result
*
*/
function set(array $param = []) {
static $must = [self::APIKEY];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path('set.json')->post($param, $h, $r);
}
}
\ No newline at end of file
... ...
<?php
namespace Yunpian\Sdk\Api;
use Yunpian\Sdk\Model\Result;
use Yunpian\Sdk\YunpianClient;
/**
* https://www.yunpian.com/api2.0/voice.html
*
* @author dzh
* @since 1.0
*/
class VoiceApi extends YunpianApi {
const NAME = "voice";
function init(YunpianClient $clnt) {
parent::init($clnt);
$this->host($clnt->conf(self::YP_VOICE_HOST, 'https://voice.yunpian.com'));
}
function name() {
return self::NAME;
}
/**
* <h1>发语音验证码</h1>
*
* <p>
* 参数名 类型 是否必须 描述 示例
* </p>
* <p>
* apikey String 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* mobile String 是 接收的手机号、固话(需加区号) 15205201314 01088880000
* </p>
* <p>
* code String 是 验证码,支持4~6位阿拉伯数字 1234
* </p>
* <p>
* encrypt String 否 加密方式 使用加密 tea (不再使用)
* </p>
* <p>
* _sign String 否 签名字段 参考使用加密 393d079e0a00912335adfe46f4a2e10f (不再使用)
* </p>
* <p>
* callback_url String 否 本条语音验证码状态报告推送地址 http://your_receive_url_address
* </p>
* <p>
* display_num String 否 透传号码,为保证全国范围的呼通率,云片会自动选择最佳的线路,透传的主叫号码也会相应变化。
* 如需透传固定号码则需要单独注册报备,为了确保号码真实有效,客服将要求您使用报备的号码拨打一次客服电话
* </p>
*
* @param array $param
* @return Result
*/
function send(array $param) {
static $must = [self::APIKEY,self::MOBILE,self::CODE];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::RESULT];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path("send.json")->post($param, $h, $r);
}
/**
* <h1>获取状态报告</h1>
*
* <p>
* 参数名 是否必须 描述 示例
* </p>
* <p>
* apikey 是 用户唯一标识 9b11127a9701975c734b8aee81ee3526
* </p>
* <p>
* page_size 否 每页个数,最大100个,默认20个 20
* </p>
*
* @param array $param
* @return Result
*/
function pull_status(array $param) {
static $must = [self::APIKEY];
$r = $this->verifyParam($param, $must);
if (!$r->isSucc()) return $r;
$v = $this->version();
$h = new CommonResultHandler(function ($rsp) use ($v) {
switch ($v) {
case self::VERSION_V1:
return $rsp[self::VOICE_STATUS];
case self::VERSION_V2:
return $rsp;
}
return null;
});
return $this->path("pull_status.json")->post($param, $h, $r);
}
}
\ No newline at end of file
... ...
<?php
namespace Yunpian\Sdk\Api;
/**
*
* @author dzh
* @since 1.0
*/
class VoidApi extends YunpianApi {
const NAME = "void";
}
\ No newline at end of file
... ...
<?php
namespace Yunpian\Sdk\Api;
use Yunpian\Sdk\Constant\Code;
use Yunpian\Sdk\Constant\YunpianConstant;
use Yunpian\Sdk\Model\Result;
use Yunpian\Sdk\YunpianClient;
/**
*
* @author dzh
* @since 1.0
*/
abstract class YunpianApi implements YunpianApiResult, YunpianConstant {
/**
*
* @var YunpianClient
*/
private $clnt;
/**
*
* @var string
*/
private $host;
/**
*
* @var string
*/
private $version;
/**
*
* @var string
*/
private $path;
/**
*
* @var string
*/
private $apikey;
/**
*
* @var string
*/
private $charset;
/**
*
* @param YunpianClient $client
*/
function init(YunpianClient $clnt) {
if (is_null($clnt)) return;
$this->clnt = $clnt;
$this->apikey = $clnt->apikey();
$this->version = $clnt->conf(self::YP_VERSION, self::VERSION_V2);
$this->charset = $clnt->conf(self::HTTP_CHARSET, self::HTTP_CHARSET_DEFAULT);
}
/**
*
* @return string
*/
abstract function name();
/**
*
* @param YunpianClient $client
* @return \Yunpian\Sdk\YunpianClient|\Yunpian\Sdk\Api\YuanpianApi
*/
function client(YunpianClient $clnt = null) {
if (is_null($clnt)) return $this->clnt;
$this->clnt = $clnt;
return $this;
}
/**
*
* @param string $host
* @return string|\Yunpian\Sdk\Api\YuanpianApi
*/
function host($host = null) {
if (is_null($host)) return $this->host;
$this->host = $host;
return $this;
}
/**
*
* @param string $version
* @return \Yunpian\Sdk\YunpianConf|\Yunpian\Sdk\Api\YuanpianApi
*/
function version($version = null) {
if (is_null($version)) return $this->version;
$this->version = $version;
return $this;
}
/**
*
* @param string $path
* @return string|\Yunpian\Sdk\Api\YuanpianApi
*/
function path($path = null) {
if (is_null($path)) return $this->path;
$this->path = $path;
return $this;
}
/**
*
* @param string $apikey
* @return string|\Yunpian\Sdk\Api\YuanpianApi
*/
function apikey($apikey = null) {
if (is_null($apikey)) return $this->apikey;
$this->apikey = $apikey;
return $this;
}
/**
*
* @param string $charset
* @return string|\Yunpian\Sdk\Api\YuanpianApi
*/
function charset($charset = null) {
if (is_null($charset)) return $this->charset;
$this->charset = charset;
return $this;
}
/**
*
* @return string
*/
function uri() {
return "{$this->host}/{$this->version}/{$this->name()}/{$this->path}";
}
/**
*
* @param array $param
* @param ResultHandler $h
* @param Result $r
* @return \Yunpian\Sdk\Model\Result|\Yunpian\Sdk\Api\r
*/
function post(array &$param, ResultHandler $h = null, Result $r = null) {
try {
$rsp = $this->clnt->post($this->uri(), $param);
return $this->result($rsp, $h, $r);
} catch (Exception $e) {
return $h->catchExceptoin($e, $r);
}
}
function result(array $rsp, ResultHandler $h = null, Result $r = null) {
// if (is_null($h)) { TODO
// $h = // default handler
// }
if (is_null($r)) {
$r = new Result();
}
$code = $this->code($rsp, $this->version);
return $code == Code::OK ? $h->succ($code, $rsp, $r) : $h->fail($code, $rsp, $r);
}
function code(array &$rsp, $version = YunpianConstant::VERSION_V2) {
if (is_null($rsp)) return Code::OK;
$code = Code::UNKNOWN_EXCEPTION;
if (is_null($version)) {
$version = self::VERSION_V2;
}
if (isset($rsp)) {
switch ($version) {
case self::VERSION_V1:
$code = array_key_exists(self::CODE, $rsp) ? (int)$rsp[self::CODE] : Code::UNKNOWN_EXCEPTION;
break;
case self::VERSION_V2:
$code = array_key_exists(self::CODE, $rsp) ? (int)$rsp[self::CODE] : Code::OK;
break;
}
}
return $code;
}
/**
*
* @param array $param
* @param array $must
* @param Result $r
* @return Result
*/
function verifyParam(array &$param, array &$must, Result $r = null) {
if (is_null($r)) {
$r = new Result();
}
if (!array_key_exists(self::APIKEY, $param)) {
$param[self::APIKEY] = $this->apikey;
}
if (isset($must)) {
foreach ($must as $p) {
if (!array_key_exists($p, $param)) {
$r->code(Code::ARGUMENT_MISSING)->detail($p);
break;
}
}
}
return $r;
}
}
\ No newline at end of file
... ...
<?php
namespace Yunpian\Sdk\Api;
use Yunpian\Sdk\Constant\Code;
use Yunpian\Sdk\Constant\YunpianConstant;
use Yunpian\Sdk\Model\Result;
interface YunpianApiResult {
/**
*
* @param array $rsp
* @param ResultHandler $h
* @param Result $r
* @return Result
*/
function result(array $rsp, ResultHandler $h, Result $r);
/**
* acquire response code
*
* @param array $rsp
* @param string $version
* @return number
*/
function code(array &$rsp, $version);
}
interface ResultHandler {
/**
* Invoked if code is 0
*
* @param int $code
* @param array $rsp
* @param Result $r
* @return Result
*/
function succ($code, array $rsp, $r);
/**
* Invoked if code is not 0
*
* @param
* int code
* @param
* array rsp
* @param Result $r
* @return r
*/
function fail($code, array $rsp, $r);
/**
*
* @param \Exception $e
* @param Result $r
*/
function catchExceptoin($e, $r);
}
class CommonResultHandler implements ResultHandler {
private $data;
function __construct(callable $data) {
$this->data = $data;
}
function succ($code, array $rsp, $r) {
if (is_null($r)) {
$r = new Result();
}
return $r->code($code)->msg(array_key_exists(YunpianConstant::MSG, $rsp) ? $rsp[YunpianConstant::MSG] : null,
true)->data(call_user_func($this->data, $rsp));
}
function fail($code, array $rsp, $r) {
if (is_null($r)) {
$r = new Result();
}
return $r->code($code)->msg(array_key_exists(YunpianConstant::MSG, $rsp) ? $rsp[YunpianConstant::MSG] : null,
true)->detail(array_key_exists(YunpianConstant::DETAIL, $rsp) ? $rsp[YunpianConstant::DETAIL] : null,
true);
}
function catchExceptoin($e, $r) {
if (is_null($r)) {
$r = new Result();
}
return $r->code(Code::UNKNOWN_EXCEPTION)->exception($e, true);
}
}
\ No newline at end of file
... ...
<?php
namespace Yunpian\Sdk\Constant;
class Code {
/**
*
* @var int success
*/
const OK = 0;
/**
* **************** 调用API时间发生的错误,需要开发者自己处理 ***************************
*/
/**
* 请求参数缺失
*/
const ARGUMENT_MISSING = 1;
/**
* 请求参数格式错误
*/
const BAD_ARGUMENT_FORMAT = 2;
/**
* 账户余额不足
*/
const MONEY_NOT_ENOUGH = 3;
/**
* 关键词过滤
*/
const BLACK_WORD = 4;
/**
* 未找到对应id的模板
*/
const TPL_NOT_FOUND = 5;
/**
* 添加模板失败
*/
const ADD_TPL_FAILED = 6;
/**
* 模板不可用
*/
const TPL_NOT_VALID = 7;
/**
* 同一手机号30秒内重复提交相同的内容
*/
const DUP_IN_SHORT_TIME = 8;
/**
* 同一手机号5分钟内重复提交相同内容超过3次
*/
const TOO_MANY_TIME_IN_5 = 9;
/**
* 手机号黑名单过滤
*/
const BLACK_PHONE_FILTER = 10;
/**
* 接口不支持GET方式调用
*/
const GET_METHOD_NOT_SUPPORT = 11;
/**
* 接口不支持POST方式调用
*/
const POST_METHOD_NOT_SUPPORT = 12;
/**
* 营销短信暂停发送
*/
const MARKET_FORBIDDEN = 13;
/**
* 解码失败
*/
const DECODE_ERROR = 14;
/**
* 签名不匹配
*/
const SIGN_NOT_MATCH = 15;
/**
* 签名格式不正确
*/
const BAD_SIGN_FORMAT = 16;
/**
* 24小时内同一手机号发送次数超过限制
*/
const DAY_LIMIT_PER_MOBILE = 17;
/**
* 签名校验失败
*/
const SIGN_NOT_VALID = 18;
/**
* 请求已失效
*/
const REQUEST_NOT_VALID = 19;
/**
* 解密失败
*/
const DECRYPT_ERROR = 21;
/**
* 不支持的国家地区
*/
const REGION_NOT_SUPPORT = 20;
/**
* 1小时内同一手机号发送次数超过限制
*/
const HOUR_LIMIT_PER_MOBILE = 22;
/**
* 发往模板支持的国家列表之外的地区
*/
const REGION_NOT_IN_TPL_LIST = 23;
/**
* 添加告警设置失败
*/
const ADD_ALARM_SETTING_FAILED = 24;
/**
* 手机号和内容个数不匹配
*/
const LENGTH_NOT_MATCH = 25;
/**
* 不支持的流量包
*/
const PACKAGE_ERROR = 26;
/**
* 未开通金额计费
*/
const NO_MONEY_FEE_TYPE_FAILED = 27;
/**
* 不支持的运营商
*/
const CARRIER_FAILED = 28;
/**
* ************* 权限相关的错误 需要开发者自己处理 ******************
*/
/**
* 非法的apikey
*/
const BAD_API_KEY = -1;
/**
* API没有权限
*/
const API_NOT_ALLOWED = -2;
/**
* IP没有权限
*/
const IP_NOT_ALLOWED = -3;
/**
* 访问次数超限
*/
const OVER_ACCESS_LIMIT = -4;
/**
* 访问频率超限
*/
const OVER_ACCESS_RATE = -5;
/**
* 不支持批量发送
*/
const NOT_SUPPORT_BATCH = -6;
/**
* ************** 系统内部错误 需要技术支持解决 ************************
*/
/**
* 未知异常
*/
const UNKNOWN_EXCEPTION = -50;
/**
* 数据库操作失败
*/
const DB_OPERATION_FAIL = -51;
/**
* 充值失败
*/
const RECHARGE_FAILED = -52;
/**
* 提交短信失败
*/
const SUBMIT_SMS_FAILED = -53;
/**
* 记录已经存在
*/
const RECORD_ALREADY_EXISTED = -54;
/**
* 记录不存在
*/
const RECORD_NOT_EXISTED = -55;
/**
* 赠送失败
*/
const PROM_FAILED = -56;
/**
* 开通固定签名功能的用户,签名未设置
*/
const SIGE_NOT_SET = -57;
}
\ No newline at end of file
... ...
<?php
namespace Yunpian\Sdk\Constant;
interface YunpianConstant {
/**
* ************************** http ************************************
*/
const HTTP_CONN_TIMEOUT = 'http.conn.timeout';
const HTTP_SO_TIMEOUT = 'http.so.timeout';
const HTTP_CHARSET = 'http.charset';
const HTTP_CONN_MAXPREROUTE = 'http.conn.maxpreroute';
const HTTP_CONN_MAXTOTAL = 'http.conn.maxtotal';
const HTTP_SSL_KEYSTORE = 'http.ssl.keystore';
const HTTP_SSL_PASSWD = 'http.ssl.passwd';
const HTTP_CHARSET_DEFAULT = 'utf-8';
/**
* ************************** yunapian.properties ************************************
*/
const YP_FILE = 'yp.file';
const YP_APIKEY = 'yp.apikey';
const YP_VERSION = 'yp.version';
const YP_USER_HOST = 'yp.user.host';
const YP_SIGN_HOST = 'yp.sign.host';
const YP_TPL_HOST = 'yp.tpl.host';
const YP_SMS_HOST = 'yp.sms.host';
const YP_VOICE_HOST = 'yp.voice.host';
const YP_FLOW_HOST = 'yp.flow.host';
const YP_CALL_HOST = 'yp.call.host';
/**
* ************************** api ************************************
*/
const VERSION_V1 = 'v1';
const VERSION_V2 = 'v2';
const APIKEY = 'apikey';
// 返回值字段
const CODE = 'code';
const MSG = 'msg';
const DETAIL = 'detail';
const DATA = 'data';
// user
const USER = 'user';
const BALANCE = 'balance';
/**
* 紧急联系人电话
*/
const EMERGENCY_MOBILE = 'emergency_mobile';
const EMERGENCY_CONTACT = 'emergency_contact';
/**
* 余额告警阈值
*/
const ALARM_BALANCE = 'alarm_balance';
const IP_WHITELIST = 'ip_whitelist';
const EMAIL = 'email';
const MOBILE = 'mobile';
const GMT_CREATED = 'gmt_created';
const API_VERSION = 'api_version';
// sign
const SIGN = 'sign';
const NOTIFY = 'notify';
const APPLYVIP = 'apply_vip';
const ISONLYGLOBAL = 'is_only_global';
const INDUSTRYTYPE = 'industry_type';
const OLD_SIGN = 'old_sign';
// tpl
/**
* 模板id
*/
const TPL_ID = 'tpl_id';
/**
* 模板值
*/
const TPL_VALUE = 'tpl_value';
/**
* 模板内容
*/
const TPL_CONTENT = 'tpl_content';
const CHECK_STATUS = 'check_status';
const REASON = 'reason';
const TEMPLATE = 'template';
/**
* 模板语言
*/
const LANG = 'lang';
const COUNTRY_CODE = 'country_code';
const NOTIFY_TYPE = 'notify_type';
// call
const FROM = 'from';
const TO = 'to';
const DURATION = 'duration';
const AREA_CODE = 'area_code';
const MESSAGE_ID = 'message_id';
const ANONYMOUS_NUMBER = 'anonymous_number';
const PAGE_SIZE = 'page_size';
// flow
const CARRIER = 'carrier';
const FLOW_PACKAGE = 'flow_package';
const _SIGN = '_sign';
const CALLBACK_URL = 'callback_url';
const RESULT = 'result';
const FLOW_STATUS = 'flow_status';
// voice
const DISPLAY_NUM = 'display_num';
const VOICE_STATUS = 'voice_status';
// sms
const EXTEND = 'extend';
const SMS_STATUS = 'sms_status';
const SMS_REPLY = 'sms_reply';
const SMS = 'sms';
const TOTAL = 'total';
const NICK = 'nick';
const UID = 'uid';
const TEXT = 'text';
const START_TIME = 'start_time';
const END_TIME = 'end_time';
const PAGE_NUM = 'page_num';
/**
* 流量充值参数
*/
const SN = 'sn';
const COUNT = 'count';
const FEE = 'fee';
const UNIT = 'unit';
const SID = 'sid';
/**
* batch_send 接口 增添的返回值名
*/
const TOTAL_COUNT = 'total_count';
const TOTAL_FEE = 'total_fee';
const SEPERATOR_COMMA = ',';
const RECORD_ID = 'record_id';
}
... ...
<?php
namespace Yunpian\Sdk\Model;
use Yunpian\Sdk\Constant\Code;
/**
* Result of HttpClient Response
*
* @author dzh
* @since 1.0
*/
class Result {
/**
*
* @var int
*/
private $code = Code::OK;
/**
*
* @var string
*/
private $msg;
/**
*
* @var string
*/
private $detail;
/**
*
* @var \Exception
*/
private $e;
/**
* json
*
* @var mixed
*/
private $data;
function __toString() {
return "{$this->code}-{$this->msg}-{$this->detail}";
}
function isSucc() {
return $this->code == Code::OK;
}
/**
*
* @param number $code
* @param boolean $rr
* @return number|\Yunpian\Sdk\Model\Result
*/
function code($code, $rr = false) {
if (isset($code) || $rr) {
$this->code = $code;
return $this;
}
return $this->code;
}
/**
*
* @param string $msg
* @param boolean $rr
* force to return $this
* @return string|\Yunpian\Sdk\Model\Result
*/
function msg($msg, $rr = false) {
if (isset($msg) || $rr) {
$this->msg = $msg;
return $this;
}
return $this->msg;
}
/**
*
* @param string $detail
* @param boolean $rr
* force to return $this
* @return string|\Yunpian\Sdk\Model\Result
*/
function detail($detail, $rr = false) {
if (isset($detail) || $rr) {
$this->detail = $detail;
return $this;
}
return $this->detail;
}
/**
*
* @param string $e
* @param boolean $rr
* @return Exception|\Yunpian\Sdk\Model\Result
*/
function exception($e, $rr = false) {
if (isset($e) || $rr) {
$this->e = $e;
return $this;
}
return $this->e;
}
/**
*
* @param array $data
* @param boolean $rr
* @return array|\Yunpian\Sdk\Model\Result
*/
function data($data, $rr = false) {
if (isset($data) || $rr) {
$this->data = $data;
return $this;
}
return $this->data;
}
}
\ No newline at end of file
... ...
<?php
namespace Yunpian\Sdk\Util;
class ApiUtil {
/**
*
* @param array $text
* @param string $sepr
* @return string
*/
static function urlEncodeAndLink(array $text, $sepr = ',') {
if (empty($text)) return '';
$count = count($text);
$r = urlencode($text[0]);
for($i = 1; $i < $count; $i++) {
$r .= $sepr . urlencode($text[$i]);
}
return $r;
}
}
\ No newline at end of file
... ...
<?php
namespace Yunpian\Sdk;
/**
*
* @author dzh
* @since 1.0
*/
class YunpianClient implements Constant\YunpianConstant {
use YunpianGuzzle;
/**
*
* @var ApiFactory
*/
private $api;
/**
*
* @var YunpianConf
*/
private $conf;
function __construct() {
$this->api = new Api\ApiFactory($this);
$this->conf = new YunpianConf();
}
/**
* Initialize/Create YunpianClient
*
* @param string $apikey
* @param array $conf
* @return \Yunpian\SDK\YunpianClient
*/
static function create($apikey, array $conf = []) {
$clnt = new YunpianClient();
$clnt->conf->init()->with($apikey, $conf);
$clnt->initHttp($clnt->conf); // YunpianGuzzle->initHttp
return $clnt;
}
/**
*
* @param string $name
* @return \Yunpian\Sdk\Api\YunpianApi
*/
private function api($name) {
return $this->api->api($name);
}
/**
*
* @return SmsApi
*/
function sms() {
return $this->api(Api\SmsApi::NAME);
}
/**
*
* @return UserApi
*/
function user() {
return $this->api(Api\UserApi::NAME);
}
/**
*
* @return VoiceApi
*/
function voice() {
return $this->api(Api\VoiceApi::NAME);
}
/**
*
* @return SignApi
*/
function sign() {
return $this->api(Api\SignApi::NAME);
}
/**
*
* @return TplApi
*/
function tpl() {
return $this->api(Api\TplApi::NAME);
}
/**
*
* @return FlowApi
*/
function flow() {
return $this->api(Api\FlowApi::NAME);
}
function conf($key = null) {
return is_null($key) ? $this->conf : $this->conf->conf($key);
}
function apikey() {
return $this->conf->apikey();
}
function __destruct() {
// print "Destroying $this\n";
}
function __toString() {
return "YunpianClient-{$this->apikey()}";
}
}
... ...
<?php
namespace Yunpian\Sdk;
/**
*
* @author dzh
* @since 1.0
*/
class YunpianConf implements Constant\YunpianConstant {
/**
*
* @var array
*/
private $conf = [];
/**
* to upsert $conf
*
* @param string $apikey
* @param array $conf
* @return \Yunpian\Sdk\YunpianConf
*/
function with($apikey, array $conf = []) {
if (!empty($conf)) foreach ($conf as $key => $value) {
$this->conf[$key] = $value;
}
if (isset($apikey)) $this->conf[self::YP_APIKEY] = $apikey;
return $this;
}
/**
* load yunpian.ini to initialize YunpianConf firstly:
* <p>
*
* </p>
*
* @return Yunpian\Sdk\YunpianConf
*/
function init() {
if (is_null($this->conf)) {
$this->conf = [];
}
$yp = parse_ini_file("yunpian.ini");
foreach ($yp as $key => $value) {
$this->conf[$key] = $value;
}
return $this;
}
/**
*
* @param string $key
* @param mixed $defval
* @return mixed
*/
function conf($key = null, $defval = null) {
if (is_null($key)) return $this->conf;
$val = $this->conf[$key];
return is_null($val) ? $defval : $val;
}
/**
*
* @return string
*/
function apikey() {
return $this->conf[self::YP_APIKEY];
}
}
\ No newline at end of file
... ...
<?php
namespace Yunpian\Sdk;
/**
*
* @deprecated
*
* @author dzh
* @since 1.0
*/
class YunpianException extends \Exception {
public function __construct($message, $code = 0, Exception $previous = null) {
parent::__construct($message, $code, $previous);
}
public function __toString() {
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
}
}
\ No newline at end of file
... ...
<?php
namespace Yunpian\Sdk;
use \Psr\Http\Message\ResponseInterface;
use GuzzleHttp\Client;
use Yunpian\Sdk\Constant\YunpianConstant;
/**
*
* @author dzh
* @since 1.0
*/
trait YunpianGuzzle{
/**
*
* @var Client
*/
private $http;
/**
* http charset
*
* @var string
*/
private $charset;
/**
*
* @param YunpianConf $conf
* @return \GuzzleHttp\Client
*/
protected function initHttp(YunpianConf $conf) {
$client = new Client($this->httpDefOptions($conf));
$this->charset = $conf->conf(YunpianConstant::HTTP_CHARSET, YunpianConstant::HTTP_CHARSET_DEFAULT);
$this->http = $client;
return $client;
}
protected function httpDefOptions(YunpianConf $conf) {
return [
'headers' => ['Api-Lang' => 'php',
'timeout' => intval($conf->conf(YunpianConstant::HTTP_SO_TIMEOUT, 30)),
'connect_timeout' => intval($conf->conf(YunpianConstant::HTTP_CONN_TIMEOUT, 10))]];
// 'Content-Type' => 'application/x-www-form-urlencoded'
}
/**
*
* @param string $uri
* @param array $data
* @param string $charset
* @param array $headers
* @param string $parse
* Parsing function for Response, as if toJson
* @return \Psr\Http\Message\ResponseInterface | mixed
*/
function post($uri, array &$data, $charset = null, array &$headers = [], $parse = "toJson") {
if (is_null($charset)) {
$charset = $this->charset;
}
$options = ['debug' => false,'form_params' => $data];
if (empty($headers)) {
$headers['Content-Type'] = "application/x-www-form-urlencoded;charset=$charset";
}
$options['_conditional'] = $headers;
try {
$rsp = $this->http()->post($uri, $options);
} catch (\GuzzleHttp\Exception\ClientException $e) {
$rsp = $e->getResponse();
}
return is_null($parse) ? $rsp : $this->$parse($rsp);
}
/**
*
* @param ResponseInterface $rsp
* @return mixed
*/
function toJson(ResponseInterface $rsp) {
return \GuzzleHttp\json_decode($rsp->getBody()->getContents(), true);
}
/**
*
* @return \GuzzleHttp\Client
*/
function http() {
return $this->http;
}
}
\ No newline at end of file
... ...
;; http time-unit:second
http.conn.timeout = 10
http.so.timeout = 30
http.charset = utf-8
;http.conn.maxperroute = 50
;http.conn.maxtotal = 200
;; ssl
;http.ssl.keystore = my.keystore
;http.ssl.passwd = passwd
;; yunpian
;yp.apikey =
yp.version = v2
yp.user.host = https://sms.yunpian.com
yp.sign.host = https://sms.yunpian.com
yp.tpl.host = https://sms.yunpian.com
yp.sms.host = https://sms.yunpian.com
yp.voice.host = https://voice.yunpian.com
yp.flow.host = https://flow.yunpian.com
yp.call.host = https://call.yunpian.com
\ No newline at end of file
... ...
<?php
namespace Yunpian\Tests\Sdk\Api;
use PHPUnit\Framework\TestCase;
use Yunpian\Sdk\Constant\YunpianConstant;
/**
*
* @author dzh
* @since 1.0
*/
class FlowApiTest extends TestCase {
use YunpianApiInit;
function _test_get_package() {
$clnt = $this->clnt;
var_dump($clnt->flow()->get_package());
// v1
// var_dump($clnt->flow()->version(YunpianConstant::VERSION_V1)->get_package());
}
function _test_recharge() {
$clnt = $this->clnt;
$param = [YunpianConstant::MOBILE => '18616020000',YunpianConstant::SN => '1008601'];
var_dump($clnt->flow()->recharge($param));
// v1
// var_dump($clnt->flow()->version(YunpianConstant::VERSION_V1)->recharge($param));
}
function _test_pull_status() {
$clnt = $this->clnt;
$param = [YunpianConstant::MOBILE => '18616020000'];
// YunpianConstant::SN=>'1008601'
var_dump($clnt->flow()->pull_status($param));
// v1
// var_dump($clnt->flow()->version(YunpianConstant::VERSION_V1)->pull_status($param));
}
}
... ...
<?php
namespace Yunpian\Tests\Sdk\Api;
use PHPUnit\Framework\TestCase;
use Yunpian\Sdk\Constant\YunpianConstant as YC;
/**
*
* @author dzh
* @since 1.0
*/
class SignApiTest extends TestCase {
use YunpianApiInit;
function _test_add() {
$clnt = $this->clnt;
$param = [YC::SIGN => '你好吗',YC::NOTIFY => 'true',YC::APPLYVIP => 'false',YC::ISONLYGLOBAL => 'false',
YC::INDUSTRYTYPE => '其他'];
var_dump($clnt->sign()->add($param));
}
function _test_update() {
$clnt = $this->clnt;
$param = [YC::OLD_SIGN => '你好吗',YC::SIGN => '我很好',YC::NOTIFY => 'true',YC::APPLYVIP => 'false',
YC::ISONLYGLOBAL => 'false',YC::INDUSTRYTYPE => '其他'];
var_dump($clnt->sign()->update($param));
}
function _test_get() {
$clnt = $this->clnt;
$param = [YC::SIGN => '',YC::PAGE_NUM => '1',YC::PAGE_SIZE => "3"];
var_dump($clnt->sign()->get($param));
}
}
... ...
<?php
namespace Yunpian\Tests\Sdk\Api;
use PHPUnit\Framework\TestCase;
use Yunpian\Sdk\Constant\YunpianConstant as YC;
use Yunpian\Sdk\Util\ApiUtil;
/**
*
* @author dzh
* @since 1.0
*/
class SmsApiTest extends TestCase {
use YunpianApiInit;
function _test_single_send() {
$clnt = $this->clnt;
$param = [YC::MOBILE => '18616020000',YC::TEXT => '【云片网】您的验证码是1234'];
var_dump($clnt->sms()->single_send($param));
}
function _test_batch_send() {
$clnt = $this->clnt;
$param = [YC::MOBILE => '18616020000',YC::TEXT => '【云片网】您的验证码是1234'];
var_dump($clnt->sms()->batch_send($param));
}
function _test_multi_send() {
$clnt = $this->clnt;
$param = [YC::MOBILE => '18616020610,18616020611',
YC::TEXT => ApiUtil::urlEncodeAndLink(['【哈哈哈】您的验证码,是1234','【哈哈哈】您的验证码是1234'])];
var_dump($clnt->sms()->multi_send($param));
}
/**
*
* @deprecated
*
*/
function _test_tpl_single_send() {
$clnt = $this->clnt;
$param = [YC::MOBILE => '18616020000',YC::TPL_ID => '1',YC::TPL_VALUE => '#company#=云片网'];
var_dump($clnt->sms()->tpl_single_send($param));
}
/**
*
* @deprecated
*
*/
function _test_tpl_batch_send() {
$clnt = $this->clnt;
$param = [YC::MOBILE => '18616020000',YC::TPL_ID => '1',YC::TPL_VALUE => '#company#=云片网'];
var_dump($clnt->sms()->tpl_batch_send($param));
}
function _test_pull_status() {
$clnt = $this->clnt;
$param = [YC::PAGE_SIZE => '20'];
var_dump($clnt->sms()->pull_status($param));
// v1
var_dump($clnt->sms()->version(YC::VERSION_V1)->pull_status($param));
}
function _test_pull_reply() {
$clnt = $this->clnt;
$param = [YC::PAGE_SIZE => '20'];
var_dump($clnt->sms()->pull_reply($param));
// v1
// var_dump($clnt->sms()->version(YC::VERSION_V1)->pull_reply($param));
}
function _test_get_record() {
$clnt = $this->clnt;
$param = [YC::START_TIME => '2013-08-11 00:00:00',YC::END_TIME => '2016-12-05 00:00:00',YC::PAGE_NUM => '1',
YC::PAGE_SIZE => '20'];
var_dump($clnt->sms()->get_record($param));
// v1
// var_dump($clnt->sms()->version(YC::VERSION_V1)->get_record($param));
}
function _test_get_black_word() {
$clnt = $this->clnt;
$param = [YC::TEXT => '高利贷,发票'];
var_dump($clnt->sms()->get_black_word($param));
// v1
// var_dump($clnt->sms()->version(YC::VERSION_V1)->get_black_word($param));
}
/**
*
* @deprecated
*
*/
function _test_send() {
$clnt = $this->clnt;
$param = [YC::MOBILE => '18616020000',YC::TEXT => '【云片网】您的验证码是1234'];
var_dump($clnt->sms()->version(YC::VERSION_V1)->send($param));
}
function _test_get_reply() {
$clnt = $this->clnt;
$param = [YC::START_TIME => '2013-08-11 00:00:00',YC::END_TIME => '2016-12-05 00:00:00',YC::PAGE_NUM => '1',
YC::PAGE_SIZE => '20'];
var_dump($clnt->sms()->get_reply($param));
// v1
// var_dump($clnt->sms()->version(YC::VERSION_V1)->get_reply($param));
}
/**
*
* @deprecated
*
*/
function _test_tpl_send() {
$clnt = $this->clnt;
$param = [YC::MOBILE => '18616020000',YC::TPL_ID => '1',YC::TPL_VALUE => '#company#=云片网'];
var_dump($clnt->sms()->version(YC::VERSION_V1)->tpl_send($param));
}
function _test_count() {
$clnt = $this->clnt;
$param = [YC::START_TIME => '2013-08-11 00:00:00',YC::END_TIME => '2016-12-05 00:00:00',YC::PAGE_NUM => '1',
YC::PAGE_SIZE => '20'];
// v1
var_dump($clnt->sms()->version(YC::VERSION_V1)->count($param));
// don't invoke count with v2,result is invalid json
// var_dump($clnt->sms()->count($param));
}
}
... ...
<?php
namespace Yunpian\Tests\Sdk\Api;
use PHPUnit\Framework\TestCase;
use Yunpian\Sdk\Constant\YunpianConstant;
/**
*
* @author dzh
* @since 1.0
*/
class TplApiTest extends TestCase {
use YunpianApiInit;
function _test_add() {
$clnt = $this->clnt;
$param = [YunpianConstant::TPL_CONTENT => '【云片网】您的验证码是#code#'];
var_dump($clnt->tpl()->add($param));
// v1
// var_dump($clnt->tpl()->version(YunpianConstant::VERSION_V1)->add($param));
}
function _test_get() {
$clnt = $this->clnt;
$param = [YunpianConstant::TPL_ID => '1'];
var_dump($clnt->tpl()->get($param));
// v1
// var_dump($clnt->tpl()->version(YunpianConstant::VERSION_V1)->get($param));
}
function _test_del() {
$clnt = $this->clnt;
$param = [YunpianConstant::TPL_ID => '1'];
var_dump($clnt->tpl()->del($param));
// v1
// var_dump($clnt->tpl()->version(YunpianConstant::VERSION_V1)->del($param));
}
function _test_get_default() {
$clnt = $this->clnt;
$param = [YunpianConstant::TPL_ID => '1'];
var_dump($clnt->tpl()->get_default($param));
// v1
// var_dump($clnt->tpl()->version(YunpianConstant::VERSION_V1)->get_default($param));
}
function _test_update() {
$clnt = $this->clnt;
$param = [YunpianConstant::TPL_ID => '1',YunpianConstant::TPL_CONTENT => '【云片网】您的验证码是#code#'];
var_dump($clnt->tpl()->update($param));
// v1
// var_dump($clnt->tpl()->version(YunpianConstant::VERSION_V1)->update($param));
}
}
... ...