PHP code example of zephia / mercadolibre

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

    

zephia / mercadolibre example snippets




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

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

var_dump($ml_response);

// object(Zephia\MercadoLibre\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');