PHP code example of printcart / php-printcart-sdk
1. Go to this page and download the library: Download printcart/php-printcart-sdk 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/ */
printcart / php-printcart-sdk example snippets
$config = array(
'Username' => 'pcsia_b9a7d6fa332b74bdd073cabbac0e6ee539ed3b361aca0c2f7b9bbfe683430cce',
'Password' => 'pcsup_02be5f225e8ddb1ff1569cf4bac0c9346c60928394902ab2f193fcd5bfc2657d'
);
PHPPrintcart\PrintcartSDK::config($config);
$printcart = new PHPPrintcart\PrintcartSDK;
$printcart = new PHPPrintcart\PrintcartSDK($config);
$products = $printcart->Product->get();
$products = $printcart->Product->count();
$productID = '1b665d2f-5a29-3e03-8698-01e4dc603fa9';
$product = $printcart->Product($productID)->get();
$product = array(
"name" => "T-shirt",
"dynamic_side" => 1,
"viewport_width" => 50.5,
"viewport_height" => 50.5,
"scale" => 50.5,
"dpi" => 100,
"dimension_unit" => "inch",
"status" => "publish",
"enable_design" => 1,
"max_file_upload" => 50,
"min_jpg_dpi" => 10,
"allowed_file_types" => [
"jpg",
"pdf",
"png"
]
);
$printcart->Product()->post($product);
$updateInfo = array(
"name" => "T-shirt update",
);
$printcart->Product($productID)->put($updateInfo);
$updateInfo = array(
'products' => [
[
"id" => "0dcccd18-18e1-4fbf-b26b-234944746ee9",
"name" => 'T-shirt update'
],
[
"id" => "41fec099-789e-444e-81d5-a29078f175b6",
"name" => "Bag update"
],
]
);
$printcart->Product()->put_batch($updateInfo);
$printcart->Product($productID)->delete();
$array = array(
'products' => [
[
"id" => "0dcccd18-18e1-4fbf-b26b-234944746ee9",
],
[
"id" => "41fec099-789e-444e-81d5-a29078f175b6",
],
]
);
$printcart->Product()->delete_batch($array);
$webHookID = 12345678;
$printcart->Webhook($webHookID)->delete();
$productID = '1b665d2f-5a29-3e03-8698-01e4dc603fa9';
$productDesigns = $printcart->Product($productID)->Design->get();
shell
composer