Print Node包装包

v0.1-alpha 2018-02-14 21:45 UTC

This package is not auto-updated.

Last update: 2024-09-29 05:14:51 UTC


README

您可以通过Composer获取此包。

composer require capsule-corp-co/printer

您需要在config/app.php中添加以下行

'providers' => [
    ...
    CapsuleCorp\Printer\PrintNodeCapsuleServiceProvider::class,
    ...
],
'aliases' => [
	...
	'PrintNodeCapsule' => CapsuleCorp\Printer\PrintNodeCapsuleFacade::class,
	....
]

接下来,您将想要发布配置文件。

php artisan vendor:publish --provider="CapsuleCorp\Printer\PrintNodeCapsuleServiceProvider"

配置

将API密钥添加到.env文件

PRINT_NODE_API_KEY=apikey

使用

获取所有打印机

/*
 * Will return an array of Printer Objects 
 */
PrintNodeCapsule::getPrinters();

/**
 * Print Example
 */

 $printers = PrintNodeCapsule::getPrinters();
 $post_job_arg = array(
     'content' => 'url to a pdf here',
     'printer' => $printer[0],
 );
 $result = PrintNodeCapsule::postPrintJob($post_job_arg);