PHP code example of ledc / xiao-hong-shu

1. Go to this page and download the library: Download ledc/xiao-hong-shu 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/ */

    

ledc / xiao-hong-shu example snippets


use Ledc\XiaoHongShu\Config;
use Ledc\XiaoHongShu\Merchant;

// 数据库或环境变量内的配置信息
$config = [
    'appKey' => '',
    'appSecret' => '',
    'version' => '2.0',
    'storeId' => '',
    'timeout' => 10,
    'enabled' => true,
];

$merchant = new Merchant(new Config($config));

/** @var \Ledc\XiaoHongShu\Merchant $merchant */

// 获取小红书HTTP客户端(处理了签名逻辑)
$client = $merchant->getClient();

// 售后接口
$afterSaleClient = $merchant->getAfterSaleClient();

// 获取公共接口
$commonClient = $merchant->getCommonClient();

// 获取库存接口
$inventoryClient = $merchant->getInventoryClient();

// 获取素材接口
$materialClient = $merchant->getMaterialClient();

// 获取授权接口
$oauthClient = $merchant->getOauthClient();

// 获取订单接口
$orderClient = $merchant->getOrderClient();

// 获取商品接口
$productClient = $merchant->getProductClient();

// 更多...