PHP code example of waltersilvacruz / laravel-meli

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

    

waltersilvacruz / laravel-meli example snippets


MeliAppService::get(string $path, array $params = [], bool $assoc = false): stdClass
MeliAppService::post(string $path, array $body = []): stdClass
MeliAppService::put(string $path, array $body = [], array $params = []): stdClass
MeliAppService::delete(string $path, array $params = []): stdClass
MeliAppService::options(string $path, array $params = []): stdClass



namespace App\Http\Controllers;

use App\Http\Controllers\Controller
use WebDEV\Meli\Services\MeliApiService;

class HomeController extends Controller
{
    public function index() {
        // it's important to inform the same state used on connection link 
        $service = new MeliApiService('store-demo-1');
        $data = $service->get('/users/me');
        dd($data);            
    }
}

$service = new MeliApiService('1281300c-a19c-42e7-9de8-6d0badccc9ad');
// or
$service = new MeliApiService('115e1b1c-fa1b-4b6c-9781-aa2f4e5f2373');
// or
$service = new MeliApiService('f237ff76-963b-4dbc-b1d3-978d1534bf63');

// then you can perform queries
$order = $service->get('/orders/768570754');
dd($order->response);
bash
$ php artisan migrate --package=waltersilvacruz/laravel-meli
meli.php
bash
    php artisan vendor:publish --tag=meli-config
    
bash
    php artisan vendor:publish --tag=meli-views
    
 
   php artisan config:clear && php artisan route:clear
   
bash
php artian meli:create-test-user [state] [site]