1. Go to this page and download the library: Download onestopmobile/printnode-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/ */
onestopmobile / printnode-sdk example snippets
use OneStopMobile\PrintNodeSdk\Enums\PrintContentType;
use OneStopMobile\PrintNodeSdk\Payloads\CreatePrintJobPayload;
use OneStopMobile\PrintNodeSdk\PrintNodeConfig;
use OneStopMobile\PrintNodeSdk\PrintNodeSdk;
$sdk = new PrintNodeSdk(new PrintNodeConfig(
apiKey: getenv('PRINTNODE_API_KEY') ?: '',
));
$whoAmI = $sdk->whoAmI();
$email = $whoAmI->email;
$computers = $sdk->computers()->all();
$printers = $sdk->printers()->all();
$printJobId = $sdk->printJobs()->create(
new CreatePrintJobPayload(
printerId: 123,
title: 'Shipping label',
contentType: PrintContentType::PdfUri,
content: 'https://example.com/label.pdf',
),
idempotencyKey: 'label-123',
);
use OneStopMobile\PrintNodeSdk\Printing\PrintManager;
public function __invoke(PrintManager $print): void
{
$print->printer(123)->pdfUrl(
'https://example.com/packing-slip.pdf',
title: 'Pakbon 1001',
);
}