daygarcia/laravel-vtex is a Laravel package for a laravel package to help you to connect to vtex api.
It currently has 2 GitHub stars and 19 downloads on Packagist.
Install it with composer require daygarcia/laravel-vtex.
Discover more Laravel packages by daygarcia
or browse all Laravel packages to compare alternatives.
Last updated
PHP 8 and later
To install via composer:
composer require daygarcia/laravel-vtex
The Configuration constructor takes a single argument: an array containing all configuration needed to connect to VTEX API:
<?php
// Still under development
use Illuminate\Http\Request;
use LaravelVtex\Configuration;
...
$config = new Configuration([
'app_token' => config('vtex.app_token'),
'app_key' => config('vtex.app_key'),
'store_name' => config('vtex.store_name')
]);
Getter and setter methods are available for the Configuration class. You can directly get and set app_token, app_key and store_name
<?php
use LaravelVtex\Configuration;
use LaravelVtex\Api\PromotionApi;
...
public function index(Request $request)
{
$config = new Configuration([
'app_token' => config('vtex.app_token'),
'app_key' => config('vtex.app_key'),
'store_name' => config('vtex.store_name')
]);
try {
$vtex = new PromotionAndTaxesApi($config);
$response = $vtex->getAllPromotions();
return $this->success($response);
} catch (Exception $e) {
return $this->error($e->getMessage(), $e->getCode());
}
}