PHP code example of webkult / shirtigo-php-api-wrapper
1. Go to this page and download the library: Download webkult/shirtigo-php-api-wrapper 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/ */
webkult / shirtigo-php-api-wrapper example snippets
use Webkult\Api\Shirtigo\WebkultApiShirtigo;
// Initialize the API client
$api = new WebkultApiShirtigo();
// Set your API key
$api->withTokenAuth('your-api-key-here');
// Access different API resources
$catalogApi = $api->catalogApi();
$orderApi = $api->orderApi();
$designApi = $api->designApi();
use Webkult\Api\Shirtigo\WebkultApiShirtigo;
$api = new WebkultApiShirtigo();
// OAuth2 flow
$oauth = $api->oauth();
$accessToken = $oauth->requestAccessToken([
'client_id' => 'your-client-id',
'client_secret' => 'your-client-secret',
'grant_type' => 'client_credentials'
]);
// Use the access token
$api->withTokenAuth($accessToken);
$catalogApi = $api->catalogApi();
// Get all base products
$products = $catalogApi->getAllBaseProducts();
// Get a specific product
$product = $catalogApi->getBaseProduct('product-id');
// List available categories
$categories = $catalogApi->listAvailableCategories();
$orderApi = $api->orderApi();
// Create a new order
$order = $orderApi->createOrder([
'products' => [
[
'product_id' => 'base-product-id',
'quantity' => 1,
'customizations' => [
// Customization options
]
]
],
'shipping_address' => [
// Address details
]
]);
// Get order details
$orderDetails = $orderApi->getOrder($order['id']);
// Calculate order price
$price = $orderApi->calculatePrice([
'products' => $order['products']
]);