PHP code example of dilneiss / shopee-php

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

    

dilneiss / shopee-php example snippets




use Shopee\Client;

  'secret' => getenv('SHOPEE_PARTNER_KEY'),
    'partner_id' => getenv('SHOPEE_PARTNER_ID'),
    'shopid' => getenv('SHOPEE_SHOP_ID'),
]);

$response = $client->item->getItemDetail(['item_id' => 1978]);

$parameters = (new \Shopee\Nodes\Item\Parameters\GetItemDetail())
    ->setItemId(1978);
$response = $client->item->getItemDetail($parameters);



/**
 * Push Mechanism (WebHook)
 *
 * @see  https://open.shopee.com/documents?module=63&type=2&id=55
 */

use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Shopee\SignatureGenerator;
use Shopee\SignatureValidator;
use Slim\Factory\AppFactory;

Validator->isValid($request)) {
        error_log('Invalid authorization signature');
        return $response;
    }

    // TODO here to handle your business logic

    // HTTP response must with status code 2xx and empty body
    return $response;
});

$app->run();