printermonk / printermonk-php
A PHP Client for PrinterMonk to give your printer an API
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/printermonk/printermonk-php
Requires
- php: >=5.6
This package is not auto-updated.
Last update: 2025-11-03 20:21:08 UTC
README
This is an open source PHP client for the PrinterMonk API
Installation
Get it with composer
composer require printermonk/printermonk-php
Example: get all printers
<?php use PrinterMonk\PrinterMonkClient; use PrinterMonk\Repositories\PrinterRepository; require __DIR__ . '/vendor/autoload.php'; $apiKey = getenv('PRINTERMONK_API_KEY'); // Your PrinterMonk API key $client = new PrinterMonkClient($apiKey); $printers = PrinterRepository::all($client); var_dump($printers);
Example: get a single printer
<?php use PrinterMonk\PrinterMonkClient; use PrinterMonk\Repositories\PrinterRepository; require __DIR__ . '/vendor/autoload.php'; $apiKey = getenv('PRINTERMONK_API_KEY'); // Your PrinterMonk API key $printerId = 'prtr_uniqueprinterkey'; $client = new PrinterMonkClient($apiKey); $printer = PrinterRepository::find($printerId, $client); var_dump($printer);
Example: send a new print job to PrinterMonk
<?php use PrinterMonk\Entities\PrintJob; use PrinterMonk\PrinterMonkClient; require __DIR__ . '/vendor/autoload.php'; $apiKey = getenv('PRINTERMONK_API_KEY'); // Your PrinterMonk API key $printerId = '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);