kduma/lpd

该软件包的最新版本(v0.1)没有可用的许可信息。

PHP LPD 客户端

v0.1 2019-04-17 23:50 UTC

This package is auto-updated.

Last update: 2024-09-18 12:44:16 UTC


README

Latest Version on Packagist Total Downloads

PHP 语言的 LPD 服务器和客户端。

安装

通过 Composer

$ composer require kduma/lpd

用法

服务器

(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();

客户端

文本打印作业

对于打印纯文本,使用 TextJob

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

文件打印作业

对于打印文件、文本或二进制文件,使用 FileJob

$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);

原始归属

本软件包基于由 Ivan Bozhanov(github.com/vakata)创建的类(服务器,2013年)和 Mick Sear(客户端,2005年)。