PHP code example of kylin987 / jd-aces-php-sdk
1. Go to this page and download the library: Download kylin987/jd-aces-php-sdk library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kylin987 / jd-aces-php-sdk example snippets
JdSdk\JdClient;
use JdSdk\request\JosVoucherInfoGetRequest;
// 初始化客户端
$client = new JdClient();
$client->appKey = "YOUR_APP_KEY";
$client->appSecret = "YOUR_APP_SECRET";
$client->accessToken = "YOUR_ACCESS_TOKEN";
$client->serverUrl = "https://api.jd.com/routerjson";
// 创建请求
$req = new JosVoucherInfoGetRequest();
$req->putOtherTextParam("voucher_id", "123456");
// 执行请求
$resp = $client->execute($req, $client->accessToken);
print_r($resp);
ACES\TDEClient;
// 初始化 TDE 客户端
$tdeClient = TDEClient::getInstance(
$accessToken,
$appKey,
$appSecret,
'https://api.jd.com/routerjson'
);
// 加密数据
$encrypted = $tdeClient->encrypt($sensitiveData);
// 解密数据
$decrypted = $tdeClient->decrypt($encrypted);
re_once __DIR__ . '/src/Bootstrap.php';
// 现在可以使用默认配置
use JdSdk\JdClient;
$client = new JdClient();
// ...
// SDK 工作目录(存放日志、缓存)
define("JD_SDK_WORK_DIR", "/path/to/your/workdir/");
// 开发模式(生产环境设为 false 提高性能)
define("JD_SDK_DEV_MODE", false);
// 日志级别
define("LOGLEVEL", \Monolog\Logger::INFO);
// 日志文件路径
define("LOGCONSOLE", "/path/to/your/tde.log");
bash
git clone [email protected] :kylin987/jd-aces-php-sdk.git
cd jd-aces-php-sdk
composer install
jd-aces-php-sdk/
├── src/
│ └── Bootstrap.php # 引导文件(可选)
├── security/ # 加密安全模块 (ACES 命名空间)
│ ├── TDEClient.php # 加密/解密主入口
│ ├── Core/ # 核心组件
│ └── Common/ # 通用组件
├── jd/ # JD API 客户端 (JdSdk 命名空间)
│ ├── JdClient.php # API 客户端
│ └── request/ # API 请求类
├── lotusphp_runtime/ # LotusPHP 框架运行时
├── composer.json
└── JdSdk.php # SDK 入口文件