PHP code example of yc-hwc / laravel-shopee

1. Go to this page and download the library: Download yc-hwc/laravel-shopee 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/ */

    

yc-hwc / laravel-shopee example snippets

`
    $config = [
        'shopeeUrl'   => 'https://partner.test-stable.shopeemobile.com',
        'partnerId'   => '',
        'partnerKey'  => '',
        'accessToken' => '',
        'shopId'      => '',
    ];
    
    $params = [
        'declare_date' => '',
        'quantity' => 1,
        'seller_info' => [
            'name'    => "tom",
            'address' => "xxxxxxx",
            'region'  => "CN",
            'zipcode' => "1xxxx15",
            'phone'   => "186xxxxxx49"
        ]
    ]
    
    $shopeeSDK = \PHPShopee\ShopeeSDK::config($config);
    $response = $shopeeSDK->firstMile
    ->api('generate_firstMile_tracking_number')
    ->withBody($params)
    ->post();
    
    print_r($response);
`
    $content = file_get_contents('path/to/file');

    $config = [
        'shopeeUrl'   => '',
        'partnerId'   => '',
        'partnerKey'  => '',
    ];

    $shopeeSDK = \PHPShopee\ShopeeSDK::config($config);
    $response = $shopeeSDK->mediaSpace()
        ->api('upload_image')
        ->attach('image', $content, md5($content))
        ->post(['scene' => 'normal']);
    print_r($response);