Skip to content

kduma-OSS/PHP-LPD

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP-LPD

Latest Version on Packagist Total Downloads

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).