PHP & Laravel

LPD Client and Server

A LPD Client and Server written in PHP

Install

Via Composer

$ composer require kduma/lpd

Usage

Server

(new KDuma\LPD\Server\Server())
    ->setAddress($address)
    ->setPort($port)
    ->setMaxConnections($max_connections)
    ->setHandler(function ($incoming_data, $ctrl) {
        echo $incoming_data; // Do something with it!
    })
    ->run();

Client

Text print job

For printing clear text use TextJob class:

$job = new KDuma\LPD\Client\Jobs\TextJob("This is content!");
$job->appdendContent("\n");
$job->appdendContent("And this is second line.");

File print job

For printing files, text or binary, use FileJob class:

$job = new KDuma\LPD\Client\Jobs\FileJob("my_raw_file.txt");
$configuration = new KDuma\LPD\Client\Configuration($address, $queue_name, $port, $timeout);

$print_service = new KDuma\LPD\Client\PrintService($configuration);

$print_service->sendJob($job);