phatkoala / printnode
PHP API library for PrintNode - remote printing for web apps
2.0.0
2023-01-26 12:01 UTC
Requires
- php: >= 7.1.0
- ext-curl: *
- ext-json: *
- symfony/http-client: ^4.3
Requires (Dev)
- phpunit/phpunit: ^8
This package is auto-updated.
Last update: 2025-03-26 16:52:02 UTC
README
Changelog
Version 2.0
- Removed composer.lock file (Credit toooni)
- Change symfony/http-client version constraint (Credit toooni)
- Implemented printing from pdf source (Credit toooni)
Version 1..0
- Initial release
About
PHP 7.1 API library for PrintNode - Remote Printing for Web Apps https://www.printnode.com/
$printNode = new PrintNode(string $auth);
Account Information
Who Am I?
// GET /whoami $printNode->getWhoAmI(); // returns WhoAmIResponse
Computers
Viewing
// GET /computers $printNode->getComputers(); // returns ComputersResponse // GET /computers/COMPUTER SET $printNode->getComputer(int $computer); // returns ComputerResponse
Removing
// DELETE /computers $printNode->deleteComputers(); // returns DeleteConfirmationResponse // DELETE /computers/COMPUTER SET $printNode->deleteComputers(int|array $computers); // returns DeleteConfirmationResponse
Printers
Viewing
// GET /printers $printNode->getPrinters(); // returns PrintersResponse // GET /printers/PRINTER SET $printNode->getPrinter(int $printer); // returns PrinterResponse // GET /computers/COMPUTER SET/printers $printNode->getComputerPrinters(int $computer); // returns PrintersResponse // GET /computers/COMPUTER SET/printers/PRINTER SET $printNode->getComputerPrinter(int $computer, int $printer); // returns PrinterResponse
Removing
// DELETE /printers $printNode->deletePrinters(); // returns DeleteConfirmationResponse // DELETE /printers/PRINTER SET $printNode->deletePrinters(int|array $printers); // returns DeleteConfirmationResponse // DELETE /computers/COMPUTER SET/printers $printNode->deleteComputerPrinters(int $computer); // returns DeleteConfirmationResponse // DELETE /computers/COMPUTER SET/printers/PRINTER SET $printNode->deleteComputerPrinters(int $computer, int|array $printers); // returns DeleteConfirmationResponse
Print Jobs
Creating
// GET /printjobs $printJobFile = $printNode->createPrintJobFile(int $printer, string $title, string $source); // returns PrintJobFile $printJobFile->send('path/to/file.pdf'); // returns Print Job ID $printJobFile = $printNode->createPrintJobPdfSource(int $printer, string $title, string $source); // returns PrintJobFile $printJobFile->send($pdfSource); // returns Print Job ID $printJobUrl = $printNode->createPrintJobUrl(int $printer, string $title, string $source); // returns PrintJobUrl $printJobUrl->send('https://www.domain.com/path/to/file.pdf'); // returns Print Job ID
Viewing
// GET /printjobs // GET /printjobs/PRINT JOB SET // GET /printers/PRINTER SET/printjobs // GET /printers/PRINTER SET/printjobs/PRINT JOB SET
Removing
// DELETE /printjobs // DELETE /printjobs/PRINT JOB SET // DELETE /printers/PRINTER SET/printjobs // DELETE /printers/PRINTER SET/printjobs/PRINT JOB SET
States
// GET /printjobs/states // GET /printjobs/PRINT JOB SET/states
Scales
HTTP REST
// GET /computer/COMPUTER ID/scales // GET /computer/COMPUTER ID/scales/DEVICE NAME // GET /computer/COMPUTER ID/scale/DEVICE NAME/DEVICE NUMBER
Testing
// PUT /scale
Account Management
Creating
// POST /account $newAccount = $printNode->createAccount('email@domain.com', 'my-passw0rd'); // returns ChildAccountRequest $newAccount ->setCreatorRef('my-unique-reference') ->addTag('likes', 'dogs') ->addTags([ 'eats' => 'pie', 'plays' => 'football', ]) ->removeTag('eats') ->addApiKey('development') ->addApiKeys([ 'staging', 'production', ]) ->removeApiKey('development'); $newAccount->send(); // returns ChildAccountResponse
Modifying
// PATCH /account
Suspending and Activating
// PUT /account/state $childAccount = $printNode->getChildAccount($id); // returns PrintNode $childAccount->suspend(); $childAccount->activate();
Deleting
// DELETE /account $childAccount = $printNode->getChildAccount($id); // returns PrintNode $childAccount->delete();
Controlling
$childAccount = $printNode->getChildAccount($id); // returns PrintNode // or $childAccount = $printNode->getChildAccount($email, PrintNode::$CHILD_AUTH_BY_EMAIL); // returns PrintNode // or $childAccount = $printNode->getChildAccount($creatorRef, PrintNode::$CHILD_AUTH_BY_CREATOR_REF); // returns PrintNode
Tagging
// POST /account/tag/NAME // GET /account/tag/NAME // DELETE /account/tag/NAME
API Keys
// POST /account/apikey/DESCRIPTION // GET /account/apikey/DESCRIPTION // DELETE /account/apikey/DESCRIPTION
Client Downloads
$clientKey = $childAccount->getClientKey($uuid, $edition, $version); // returns string
Miscellaneous
Ping
// GET /ping PrintNode::ping(); // returns true/false
Noop
// GET /noop $printNode->noop(); // returns true/false