Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/smalot/cups-ipp
CUPS Implementation of IPP - PHP Client API
https://github.com/smalot/cups-ipp
api client cups ipp jobs php printer sock unix
Last synced: 1 day ago
JSON representation
CUPS Implementation of IPP - PHP Client API
- Host: GitHub
- URL: https://github.com/smalot/cups-ipp
- Owner: smalot
- License: gpl-2.0
- Created: 2017-04-30T21:13:23.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-10-27T08:03:50.000Z (about 2 years ago)
- Last Synced: 2024-12-07T03:09:49.715Z (about 1 month ago)
- Topics: api, client, cups, ipp, jobs, php, printer, sock, unix
- Language: PHP
- Size: 168 KB
- Stars: 107
- Watchers: 11
- Forks: 56
- Open Issues: 26
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://travis-ci.org/smalot/cups-ipp.png?branch=master)](https://travis-ci.org/smalot/cups-ipp)
[![Current Version](https://poser.pugx.org/smalot/cups-ipp/v/stable.png)](https://packagist.org/packages/smalot/cups-ipp)
[![composer.lock](https://poser.pugx.org/smalot/cups-ipp/composerlock)](https://packagist.org/packages/smalot/cups-ipp)[![Total Downloads](https://poser.pugx.org/smalot/cups-ipp/downloads.png)](https://packagist.org/packages/smalot/cups-ipp)
[![Monthly Downloads](https://poser.pugx.org/smalot/cups-ipp/d/monthly)](https://packagist.org/packages/smalot/cups-ipp)
[![Daily Downloads](https://poser.pugx.org/smalot/cups-ipp/d/daily)](https://packagist.org/packages/smalot/cups-ipp)## Install via Composer
You can install the component using [Composer](https://getcomposer.org/).
````sh
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
getList();foreach ($printers as $printer) {
echo $printer->getName().' ('.$printer->getUri().')'.PHP_EOL;
}````
### List all printer's jobs
````php
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
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);````