Digital Revolution IPP library
Requires
- php: ^8.3
- digitalrevolution/utils: ^1.0
- nyholm/psr7: ^1.8
- psr/http-client: ^1.0
- psr/log: ^3.0
Requires (Dev)
- digitalrevolution/accessorpair-constraint: ^v2.4.1
- digitalrevolution/php-codesniffer-baseline: ^1.1
- digitalrevolution/phpunit-file-coverage-inspection: ^3.0
- phpmd/phpmd: ^2.12
- phpstan/extension-installer: ^1.2
- phpstan/phpstan: ^2.0.0
- phpstan/phpstan-phpunit: ^2.0.0
- phpunit/phpunit: ^12.0
- roave/security-advisories: dev-latest
- slevomat/coding-standard: ^8.16
- squizlabs/php_codesniffer: ^3.7
This package is auto-updated.
Last update: 2025-07-02 14:56:41 UTC
README
Digitalrevolution IPP library
A library to aid using the ipp protocol in php, for example to send print jobs to print servers that support the protocol
Installation
composer require digitalrevolution/ipp
Usage
Initialize the library
$server = new IppServer(); $server->setUri('https://cups.local'); $server->setUsername('admin'); // optional $server->setPassword('admin'); // optional $ipp = new Ipp($server, new Psr18Client());
Print a file
// define a printer $printer = new IppPrinter(); $printer->setHostname('my.printer'); // print a file on the selected printer $ippFile = new IppPrintFile(file_get_contents('/dir/file.ps'), FileTypeEnum::PS); $ipp->print($printer, $ippFile);
Fetch job attributes
$printJob = $ipp->print($printer, $ippFile); $updatedPrintJob = $ipp->getJobAttributes($printJob->getJobUri());
Register a printer with cups
$printer = new IppPrinter(); $printer->setHostname('my.printer'); $printer->setDeviceUri('my.uri'); $printer->setLocation('location'); $ipp->printerAdministration()->createPrinter($printer);
Delete a printer
$printer = new IppPrinter(); $printer->setHostname('my.printer'); $ipp->printerAdministration()->deletePrinter($printer);
Contributing
See contributing.md
Pull requests welcome for adding standard IPP Operations
Creating a custom IPP operation
This project is created to be easily extensible, adding a new IPP operation is as simple as making sure it has an identifier in IppOperationEnum
Then adding any Job, Printer or Operation Attributes as required by your standard.
Finally sending the request and parsing the response using the standard parser.
class MyOperation { public function __construct(private readonly IppHttpClientInterface $client) { } public function myOperation(): IppResponseInterface $operation = new IppOperation(IppOperationEnum::OperationType); $operation->addOperationAttribute(new IppAttribute(IppTypeEnum::Charset, 'attributes-charset', 'utf-8')); // set your attributes return $this->client->sendRequest($operation); } }
About us
At 123inkt (Part of Digital Revolution B.V.), every day more than 50 development professionals are working on improving our internal ERP and our several shops. Do you want to join us? We are looking for developers.