PHP code example of wxm / pdd-sdk

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

    

wxm / pdd-sdk example snippets


$pdd = new \Pdd\Application('client_id', 'client_secret');

// 例如 pdd.ddk.goods.search 其他接口同理
$pdd->ddk->goods->search();

    \Pdd\ServiceProvider::class
    

    // 例如 pdd.ddk.goods.search 其他接口同理
    \Pdd\Facades\Pdd::ddk()->goods->search();
    

    $app->register(\Pdd\ServiceProvider::class);
    

    // 例如 pdd.ddk.goods.search 其他接口同理
    \Pdd\Facades\Pdd::ddk()->goods->search();
    

\Pdd\Facades\Pdd::oauth()->getAuthorizeUrl(); // 获取授权地址
\Pdd\Facades\Pdd::oauth()->parseAccessToken('code'); // code 换 access_token 
\Pdd\Facades\Pdd::oauth()->refreshAccessToken('refresh_token'); // 刷新 access_token
shell
    php artisan vendor:publish --provider="\Pdd\ServiceProvider" --force