2017 © Pedro PelĂĄez
 

library cups-ipp

CUPS Implementation of IPP - PHP Client API

image

oscarsalomon89/cups-ipp

CUPS Implementation of IPP - PHP Client API

  • Friday, March 9, 2018
  • by oscarsalomon89
  • Repository
  • 1 Watchers
  • 0 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Cups IPP

CUPS Implementation of IPP - PHP Client API, (*1)

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., (*2)

Build Status Current Version composer.lock, (*3)

Total Downloads Monthly Downloads Daily Downloads, (*4)

Install via Composer

You can install the component using Composer., (*5)

composer require oscarsalomon89/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., (*6)

Requirements

This library use unix sock connection: unix:///var/run/cups/cups.sock, (*7)

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

Implementation

List printers

<?php

include 'vendor/autoload.php';

use oscarsalomon89\Cups\Builder\Builder;
use oscarsalomon89\Cups\Manager\PrinterManager;
use oscarsalomon89\Cups\Transport\Client;
use oscarsalomon89\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 oscarsalomon89\Cups\Builder\Builder;
use oscarsalomon89\Cups\Manager\JobManager;
use oscarsalomon89\Cups\Manager\PrinterManager;
use oscarsalomon89\Cups\Transport\Client;
use oscarsalomon89\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 oscarsalomon89\Cups\Builder\Builder;
use oscarsalomon89\Cups\Manager\JobManager;
use oscarsalomon89\Cups\Manager\PrinterManager;
use oscarsalomon89\Cups\Model\Job;
use oscarsalomon89\Cups\Transport\Client;
use oscarsalomon89\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);

The Versions

09/03 2018

dev-master

9999999-dev

CUPS Implementation of IPP - PHP Client API

  Sources   Download

MIT GPL-v2

The Requires

 

The Development Requires

by Oscar Salomon

09/03 2018

v0.4.0

0.4.0.0

CUPS Implementation of IPP - PHP Client API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Oscar Salomon

09/03 2018

v0.3.1

0.3.1.0

CUPS Implementation of IPP - PHP Client API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Oscar Salomon

09/03 2018

v0.3.0

0.3.0.0

CUPS Implementation of IPP - PHP Client API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Oscar Salomon

08/03 2018

v0.2.2

0.2.2.0

CUPS Implementation of IPP - PHP Client API

  Sources   Download

GPL-v2

The Requires

 

The Development Requires

by Oscar Salomon

05/02 2018
10/05 2017
10/05 2017