temant/printer
Composer 安装命令:
composer require temant/printer
包简介
A simple PHP library for interacting with network printers.
README 文档
README
A simple PHP library for interacting with network printers. It allows sending data to printers over the network via the RAW printing protocol.
Installation
-
Clone the repository:
git clone https://github.com/slvstar/temant-printer.git
-
Install dependencies using Composer:
composer install
Usage
Printer Class
To create a printer instance and print data:
use Temant\Printer\Printer; $printer = new Printer('192.168.1.100', 9100); // Use the correct IP and port of your printer $printer->print("Hello Printer!"); echo $printer->getPrinterStatus(); // Output: 'Online' if connected
Exception Handling
The library throws the following exceptions:
PrinterException: For issues with the printer connection or printing.ConnectionException: For connection failures.
Running Tests
To run tests, you need PHPUnit installed:
composer require --dev phpunit/phpunit
Run the tests:
./vendor/bin/phpunit tests
PHPStan Analysis
To ensure the code follows best practices and type safety, use PHPStan for static analysis:
composer require --dev phpstan/phpstan ./vendor/bin/phpstan analyse
License
MIT License. See LICENSE file for details.
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-24