from: @Israel Pereira
composer require signifly/laravel-struct
php artisan vendor:publish --tag="struct"
.env file and their respective values:STRUCT_URL=
STRUCT_TOKEN=
These values can be obtained from your Struct dashboard.
STRUCT_URL is your base URL (don’t forget to include the https://)STRUCT_TOKEN is your Struct API Token that can be found under Settings > API configuration.No class instantiation is required. After publishing the necessary files (item 1.2) and filling in the information in your .env file (item 1.3), you are ready to use it.
This package was written to interact with the Struct API in a way familiar to Laravel developers.
Start by importing the class (entity) you want to use in your application:
use Signifly\\Struct\\Api\\Product\\Product as StructProduct;
...
public function index()
{
return StructProduct::all();
}
public function show(int $id)
{
return StructProduct::show(id: $id);
}