PHP code example of thank-song / lingxing

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

    

thank-song / lingxing example snippets


return [
    // 使用 .env 中的配置自动初始化
    'appId'=>env('LINGXING_APP_ID','YOUR-APP-ID-HERE'),
    'appSecret'=>env('LINGXING_APP_SECRET','YOUR-APP-SECRET-HERE'),
    'host' => env('LINGXING_HOST','https://openapi.lingxing.com')
];


use ThankSong\LingXing\Request\GetOrderListRequest;

$request = new GetOrderListRequest();
$request -> setOffset(0)
         -> setLength(20)
         -> setDateType('update_time')
         -> setStartTime(now()->subHours(2)->timestamp)
         -> setEndTime(now()->endOfDay()->timestamp);
$response = $request -> send();

dump($response -> getData());


use ThankSong\LingXing\LingXing;

$res = LingXing::basicRequest('/erp/sc/data/local_inventory/supplier',['offset'=>$offset,'length'=>$length]);
dump($res -> getData());
dump($res -> hasMore());


use ThankSong\LingXing\LingXing;

$res = LingXing::getProducts();
dump($res -> getData());
dump($res -> hasMore());
bash
php artisan vendor:publish --tag=lingxing