PHP code example of zacksleo / suning-sdk

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

    

zacksleo / suning-sdk example snippets



use Zacksleo\SuningSdk\Suning;

$suning = new Suning([
    'key'        => 'key',
    'secret'     => 'secret',
    'debug'      => false,
    'log' => [
        'file'       => __DIR__.'/suning.log',
        'level'      => 'error',
        'permission' => 0777,
    ]
]);


$response = $suning->custom->logisticcompany->get(['companyName' => '申通快递',]);

$response = $suning->request([
    'suning.custom.logisticcompany.get' => 'logisticCompany'
], [
    'companyName' => '申通快递',
]);

$response = $suning->request('suning.custom.logisticcompany.get', [ 'companyName' => '申通快递' ]);

$response = $suning->request('custom.logisticcompany.get', [ 'companyName' => '申通快递', ]);

try {
    $response = $suning->custom->logisticcompany->get([
        'companyName' => '申通快递',
    ]);
} catch (\Exception $exception) {
    var_dump($exception->getMessage());
}
bash
array:2 [
  "header" => array:4 [
    "pageTotal" => 1
    "pageNo" => 1
    "totalSize" => 1
    "returnMessage" => ""
  ]
  "body" => array:2 [
    "expressCompanyName" => "申通快递"
    "expressCompanyCode" => "S01"
  ]
]

bash
php ./bin/suning fake:generate