PHP code example of printermonk / printermonk-php

1. Go to this page and download the library: Download printermonk/printermonk-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

printermonk / printermonk-php example snippets




use PrinterMonk\PrinterMonkClient;
use PrinterMonk\Repositories\PrinterRepository;

terMonkClient($apiKey);
$printers = PrinterRepository::all($client);

var_dump($printers);



use PrinterMonk\PrinterMonkClient;
use PrinterMonk\Repositories\PrinterRepository;

uniqueprinterkey';

$client = new PrinterMonkClient($apiKey);
$printer = PrinterRepository::find($printerId, $client);

var_dump($printer);



use PrinterMonk\Entities\PrintJob;
use PrinterMonk\PrinterMonkClient;

erId = 'prtr_uniqueprinterkey';

$client = new PrinterMonkClient($apiKey);

$printJob = new PrintJob();
$printJob->printerId = $printerId;
$printJob->name = 'Example document';
$printJob->contentType = 'pdf';
$printJob->content = base64_encode(file_get_contents('example.pdf'));

$printJob->post($client);


composer