PHP code example of zodream / thirdparty

1. Go to this page and download the library: Download zodream/thirdparty 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/ */

    

zodream / thirdparty example snippets


'qq' => [
    'client_id' => '',
    'redirect_uri' => '',
    'client_secret' => ''
],

$uri = QQ::login();

$oauth->callback();
$oauth->info();

'wechat' => [
    'appid' => '',
    'redirect_uri' =>  ,
    'secret' => ''
],

$uri = QQ::login();

$oauth->callback();
$oauth->info();

'weibo' => [
    'client_id' => ' ',
    'redirect_uri' => '',
    'client_secret' => ''
],

$uri = QQ::login();

$oauth->callback();
$oauth->info();

'wechat' => array(
    'appid' => '应用ID',
    'mch_id' => '商户号',
    'device_info' => 'web',
    'notify_url' => '异步回调网址',
    'trade_type' => 'APP',
    'key' => '密钥'
)

$pay = new WeChat();
$order = $pay->order([
    'body' => '应用名-商品名',
    'out_trade_no' => 订单号,
    'total_fee' => 1分钱,
    'spbill_create_ip' => IP,
    'time_start' => date('Ymdis')
]);

$pay->pay([
    'timestamp' =>  $model->created_at
])

$pay = new WeChat();
$data = $pay->callback();
if (empty($data)) {
    die($pay->appCallbackReturn([
        'return_code' => 'FAIL',
        'return_msg' => $pay->getError()
    ]));
}
die($pay->notifySuccess()); //成功时输出

'alipay' => array(
    'key' => '',
    'privateKeyFile' => '/alipay/rsa_private_key.pem',
    //'publicKeyFile' => '/alipay/alipay_rsa_public_key.pem',
    'publicKey' => '',
    'notify_url' => '',
    'partner' => '商户号',
    'seller_id' => 收款账号
)

$pay = new AliPay();
$pay->mobilePayOrder([
    'timestamp' => date('Y-m-d H:i:s'),
    'subject' => 标题,
    'out_trade_no' => 订单号,
    'total_fee' => 0.01 元,
    'body' => 介绍
]);

$pay = new AliPay();
$data = $pay->callback();
die('success'); //成功时输出

'sms' => array(
    'app_key' => '',
    'secret' => '',
)

$sms = new ALiDaYu();
$sms->send('手机号', '模板id', [模板参数], '签名');

'sms' => array(
    'account' => '账号',
    'password' => '密码',
    'template' => '{code}',   // 设置验证码模板
)

IHuYi::sendCode('13412341234', '123456'): bool|ErrorException;

IHuYi::send('13412341234', '');

IHuYi::balance();

Search::putBaiDu(['site' => '', 'token' => '']);