Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 1.09 KB

File metadata and controls

48 lines (34 loc) · 1.09 KB

PHP LPD

Latest Stable Version Total Downloads License

LPD (Line Printer Daemon) client and server implementation in pure PHP.

Full documentation: opensource.duma.sh/libraries/php/lpd

Requirements

  • PHP ^8.3

Installation

composer require kduma/lpd

Usage

Client

$configuration = new KDuma\LPD\Client\Configuration(
    address: '192.168.1.100',
    queue: 'PASSTHRU',
    port: 515,
    timeout: 30,
);

$job = new KDuma\LPD\Client\Jobs\TextJob("Hello, Printer!");

(new KDuma\LPD\Client\PrintService($configuration))->sendJob($job);

Server

(new KDuma\LPD\Server\Server())
    ->setAddress('0.0.0.0')
    ->setPort(515)
    ->setHandler(function (string $data, mixed $ctrl): void {
        echo $data;
    })
    ->run();