PHP code example of winkelco / mercadolibre-api

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

    

winkelco / mercadolibre-api example snippets




// Instantiate serializer with configurations.
$serializer = \JMS\Serializer\SerializerBuilder::create()
   ->addMetadataDir(__DIR__ . '/../../resources/config/serializer')
   ->build();
   
// Instantiate client.
$client = new WinkelCo\MercadoLibreApi\Client\MercadoLibreClient(
    [],
    $serializer
);

// Call show user.
$ml_response = $client->showUser(1);

var_dump($ml_response);

// object(Winkelco\MercadoLibreApi\Entity\User)


    $client->userShow('123');
    

    $client->userShowMe();
    

    $client->userPackages();
    

    $client->categoryList();
    

    $client->categoryPredict('MLA', 'Fiat Uno');
    

    $item = new Zephia\MercadoLibre\Entity\Item;
    $client->itemCreate($item);
    

    $client->itemShow('MLA123123');
    

    $client->setAccessToken(ACCESS_TOKEN)->itemList('user_id');