php-tool-kit

PHP工具箱

安装

composer require oywenjiao/php-tool-kit

文件目录说明

Express 快递工具箱

Baidu 百度快递查询接口

使用示例

$obj = new Baidu(); $response = $obj->query('YT123456', '圆通速递');

BirdLogistics 快递鸟查询接口

使用示例

$appKey = 'your app_key'; // 快递鸟账号密钥 $businessId = 'your businessId'; // 快递鸟账号id $obj = new BirdLogistics($appKey, $businessId); $trade_sn = '123456'; // 商户订单号 $ship_code = 'YTO'; // 快递公司编码 $ship_sn = '123456'; // 快递单号 $response = $obj->getOrderTracesByJson($trade_sn, $ship_code, $ship_sn);

Wechat 微信生态

WxBase 微信操作公共类,所有的微信相关api基于该公共类的基础上进行调用

示例

$appId = 'your appid'; // 公众号appid $appSecret = 'your appSecret'; // 公众号app_secret $base = new WxBase($appId, $appSecret);

Order 微信订单操作类

示例

$wx_order = new Order($base); $mchId = "your mch_id"; // 商户号id $key = "your key"; // 商户密钥 $wx_order->setMchID($mchId)->setKey($key); // 设置密钥和商户号 // 调用统一下单接口 $openid = 'your openid'; // 用户openid $trade_sn = 'your trade_sn'; // 商户订单号 $price = '1.00'; // 订单价格 $notify = 'your notify'; // 回调地址 $res = $wx_order->unifiedOrder($openid, $trade_sn, $price, $notify); // 调用企业付款 $wx_order = new Order($base); $cert = 'your cert'; // cert 证书路径 $ssl_key = 'your ssl_key'; // ssl_key 证书路径 $openid = 'your openid'; // 用户openid $trade_sn = 'your trade_sn'; // 商户订单号 $price = '1.00'; // 提现金额 $desc = '提现描述'; $wx_order->setMchID($mchId)->setKey($key)->setCert($cert)->setSslKey($ssl_key); $res = $wx_order->payToUser($openid, $trade_sn, $price, $desc);

TemplateMessage 微信消息操作类

示例

$message = new TemplateMessage($base); $openid = 'user openid'; // 接收消息的用户openid $template_id = 'your template_id'; // 消息模板id $params = []; // 消息模板需传递的参数数组 $page = 'your xcx page url'; // 消息跳转地址 $result = $message->sendXcxMessage($openid, $template_id, $params, $page);

Kind 工具类集合

AuthManage 权限相关的类

JwtManage jwt验证类

示例

$publicKey = 'your public_key'; // 公钥 $privateKey = 'your private_key'; // 私钥 $jwt = new JwtManage($publicKey, $privateKey); // 加密 $payload = array('user_id' => 1234, 'expire' => time() + 100); $token = $jwt->encode($payload); // 解密 $result = $jwt->decode($token);

版权声明:

1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。
2、网站不提供资料下载,如需下载请到原作者页面进行下载。
3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考学习用!
4、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。