kduma / lpd
There is no license information available for the latest version (v0.1) of this package.
LPD Client for PHP
v0.1
2019-04-17 23:50 UTC
Requires
- ext-mbstring: *
- ext-sockets: *
This package is auto-updated.
Last update: 2024-10-18 12:47:35 UTC
README
LPD Server and Client for PHP language.
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");
Print Service
$configuration = new KDuma\LPD\Client\Configuration($address, $queue_name, $port, $timeout); $print_service = new KDuma\LPD\Client\PrintService($configuration); $print_service->sendJob($job);
Original Attribution
This package is based on classes created by Ivan Bozhanov (server, 2013) and Mick Sear (client, 2005).