All Projects → smalot → Cups Ipp

smalot / Cups Ipp

Licence: gpl-2.0
CUPS Implementation of IPP - PHP Client API

Projects that are alternatives of or similar to Cups Ipp

Gitter Api
[production-ready] Gitter API implementation for php 7.0+ allowing sync, async and streaming access.
Stars: ✭ 11 (-84.29%)
Mutual labels:  api, client
Https
Secure HTTP client with SSL pinning for Nativescript - iOS/Android
Stars: ✭ 45 (-35.71%)
Mutual labels:  api, client
Vainglory
(*DEPRECATED*: The API no longer exists, so this will no longer work) A Javascript API Client wrapper for Vainglory
Stars: ✭ 32 (-54.29%)
Mutual labels:  api, client
Instagram Web Api
🤳 Instagram Private Web API client for Node
Stars: ✭ 694 (+891.43%)
Mutual labels:  api, client
Fredr
An R client for the Federal Reserve Economic Data (FRED) API
Stars: ✭ 61 (-12.86%)
Mutual labels:  api, client
Swaddle
Automagically create API clients/wrappers in JavaScript
Stars: ✭ 23 (-67.14%)
Mutual labels:  api, client
Nineapi
Unofficial python client library for *official* 9GAG API. (alpha)
Stars: ✭ 43 (-38.57%)
Mutual labels:  api, client
Purest
REST API Client Library
Stars: ✭ 448 (+540%)
Mutual labels:  api, client
Adrestia
APIs & SDK for interacting with Cardano.
Stars: ✭ 56 (-20%)
Mutual labels:  api, client
Dsc Mercado Livre
Biblioteca de integração com o Mercado Livre
Stars: ✭ 55 (-21.43%)
Mutual labels:  api, client
Unifi Api Client
A PHP API client class to interact with Ubiquiti's UniFi Controller API
Stars: ✭ 602 (+760%)
Mutual labels:  api, client
Dimscord
A Discord Bot & REST Library for Nim.
Stars: ✭ 67 (-4.29%)
Mutual labels:  api, client
Twitchlib
C# Twitch Chat, Whisper, API and PubSub Library. Allows for chatting, whispering, stream event subscription and channel/account modification. Supports .NET Core 2.0
Stars: ✭ 519 (+641.43%)
Mutual labels:  api, client
Hvac
🔒 Python 2.7/3.X client for HashiCorp Vault
Stars: ✭ 839 (+1098.57%)
Mutual labels:  api, client
Awesome Openapi3
😎 A list of awesome projects related to OpenAPI 3.0.x, curated by the community
Stars: ✭ 469 (+570%)
Mutual labels:  api, client
Gochimp3
🐒 Golang client for MailChimp API 3.0.
Stars: ✭ 39 (-44.29%)
Mutual labels:  api, client
Airtable Python Wrapper
Python Airtable Client Wrapper
Stars: ✭ 328 (+368.57%)
Mutual labels:  api, client
Node Vault
Client for HashiCorp's Vault
Stars: ✭ 391 (+458.57%)
Mutual labels:  api, client
Sechub
SecHub - one central and easy way to use different security tools with one API/Client
Stars: ✭ 52 (-25.71%)
Mutual labels:  api, client
Igdb
Go client for the Internet Game Database API
Stars: ✭ 65 (-7.14%)
Mutual labels:  api, client

Cups IPP

CUPS Implementation of IPP - PHP Client API

CUPS (Common Unix Printing System) is a modular printing system for Unix-like computer operating systems which allows a computer to act as a print server. A computer running CUPS is a host that can accept print jobs from client computers, process them, and send them to the appropriate printer.

Build Status Current Version composer.lock

Total Downloads Monthly Downloads Daily Downloads

Install via Composer

You can install the component using Composer.

composer require smalot/cups-ipp

Then, require the vendor/autoload.php file to enable the autoloading mechanism provided by Composer. Otherwise, your application won't be able to find the classes of this component.

Requirements

This library use unix sock connection: unix:///var/run/cups/cups.sock

First of all, check if you have correct access to this file: /var/run/cups/cups.sock

Implementation

List printers

<?php

include 'vendor/autoload.php';

use Smalot\Cups\Builder\Builder;
use Smalot\Cups\Manager\PrinterManager;
use Smalot\Cups\Transport\Client;
use Smalot\Cups\Transport\ResponseParser;

$client = new Client();
$builder = new Builder();
$responseParser = new ResponseParser();

$printerManager = new PrinterManager($builder, $client, $responseParser);
$printers = $printerManager->getList();

foreach ($printers as $printer) {
    echo $printer->getName().' ('.$printer->getUri().')'.PHP_EOL;
}

List all printer's jobs

<?php

include 'vendor/autoload.php';

use Smalot\Cups\Builder\Builder;
use Smalot\Cups\Manager\JobManager;
use Smalot\Cups\Manager\PrinterManager;
use Smalot\Cups\Transport\Client;
use Smalot\Cups\Transport\ResponseParser;

$client = new Client();
$builder = new Builder();
$responseParser = new ResponseParser();

$printerManager = new PrinterManager($builder, $client, $responseParser);
$printer = $printerManager->findByUri('ipp://localhost:631/printers/HP-Photosmart-C4380-series');

$jobManager = new JobManager($builder, $client, $responseParser);
$jobs = $jobManager->getList($printer, false, 0, 'completed');

foreach ($jobs as $job) {
    echo '#'.$job->getId().' '.$job->getName().' - '.$job->getState().PHP_EOL;
}

Create and send a new job

<?php

include 'vendor/autoload.php';

use Smalot\Cups\Builder\Builder;
use Smalot\Cups\Manager\JobManager;
use Smalot\Cups\Manager\PrinterManager;
use Smalot\Cups\Model\Job;
use Smalot\Cups\Transport\Client;
use Smalot\Cups\Transport\ResponseParser;

$client = new Client();
$builder = new Builder();
$responseParser = new ResponseParser();

$printerManager = new PrinterManager($builder, $client, $responseParser);
$printer = $printerManager->findByUri('ipp://localhost:631/printers/HP-Photosmart-C4380-series');

$jobManager = new JobManager($builder, $client, $responseParser);

$job = new Job();
$job->setName('job create file');
$job->setUsername('demo');
$job->setCopies(1);
$job->setPageRanges('1');
$job->addFile('./helloworld.pdf');
$job->addAttribute('media', 'A4');
$job->addAttribute('fit-to-page', true);
$result = $jobManager->send($printer, $job);

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].