PHP code example of zuragan / lazada-api-php

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

    

zuragan / lazada-api-php example snippets


//Create API instance
$api = new LazadaAPI($baseUrl);

//Create action using factory, get or post action is supported
$factory = new ActionFactory($userEmail, $userAPIKey);
$action = $factory->getAction('ActionName', [ 'Parameter' => 'ParamValue' ]);

//Execute API Command
$response = $api->get($action);

//debug: dump response
var_dump($response);

//Create API instance
$api = new LazadaAPI($baseUrl);

//Create action using factory, get or post action is supported
$factory = new ActionFactory($userEmail, $userAPIKey);
$payload = [
    "Attributes" => [
        "name" => "Example",
        "description" => "Short description",
    ],
];
$action = $factory->postAction('ActionName', [ 'Parameter' => 'ParamValue' ], $payload);

//Execute API Command
$response = $api->post($action);

//debug: dump response
var_dump($response);

~$ composer