PHPackages                             d3yii2/d3printer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. d3yii2/d3printer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

d3yii2/d3printer
================

Printer Monitoring

3156↓75%2PHP

Since Nov 16Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/d3yii2/d3printer)[ Packagist](https://packagist.org/packages/d3yii2/d3printer)[ RSS](/packages/d3yii2-d3printer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (8)Used By (0)

[![Yii2](https://camo.githubusercontent.com/d6b0929173e28cc627430d2519ca1853466a70f37395877eaf4820cb3e1e1909/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f77657265645f62792d5969695f4672616d65776f726b2d677265656e2e7376673f7374796c653d666c6174)](https://www.yiiframework.com/)

Printer Monitoring"
===================

[](#printer-monitoring)

Features
--------

[](#features)

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
$ composer require d3yii2/d3printer "*"

```

or add to composer require part

```
"d3yii2/d3printer": "*"
```

if use zpl

```
"robgridley/zebra": "v2.0.2"
```

Printers define as components
-----------------------------

[](#printers-define-as-components)

For each type printer create its own class See components/D3PrinterGodex5000.php

Labels
------

[](#labels)

Labels create as object. Example:

```
namespace components\printers;

use d3yii2\d3printer\components\G500LabelBase;
use d3yii2\d3printer\components\G500LabelInterface;
use Dbr\Ezpl\Builder;
use Dbr\Ezpl\Command\CommandPipe;
use Dbr\Ezpl\Command\Image\QRCode;

class G500ProductLabel extends G500LabelBase implements G500LabelInterface
{
    /** @var string */
    public $qrCode;

    /** @var $date */
    public $date;

    /** @var float */
    public $qnt;

    /** @var string */
    public $unitLabel;

    /** @var string */
    public $productName;

    public function createCommand(): Builder
    {
        return (new Builder(new CommandPipe()))
            ->resetMemory()
            ->setLabelHeight($this->labelHeight, 2)
            ->setLabelWidth($this->labelWidth)
            ->setDensity($this->density)
            ->copies($this->copies)
            ->labelStart()
            ->qrcode($this->createQrCode())
            ->text(14, 250, 10, 1, 1, 0, 0, $this->date)
            ->text(18, 250, 70, 1, 1, 0, 0, $this->qnt . ' ' . $this->unitLabel)
            ->text(10, 250, 200, 1, 1, 0, 0, $this->qrCode)
            ->text(14, 10, 260, 1, 1, 0, 0, $this->productName)
            ->labelEnd();
    }

    public function createQrCode(): QRCode
    {
        return (new QRCode($this->qrCode))
            ->setHorizontal(10)
            ->setVertical(10)
            ->setInputMode(QRCode::INPUT_MODE_MIXING)
            ->setType(QRCode::TYPE_ORIGINAL)
            ->setErrorLevel(QRCode::ERROR_CORRECTION_MEDIUM)
            ->setMaskingFactor(QRCode::MASKING_AUTO)
            ->setMultiple(10)
            ->setRotate(0);
    }
}
```

Usage
-----

[](#usage)

```
require('../../../../autoload.php');
require('../../../../yiisoft/yii2/Yii.php');

use aluksne\app\components\printers\G500ProductLabel;
use d3yii2\d3printer\components\D3PrinterGodex5000;

$label = Yii::createObject([
    'class' => G500ProductLabel::class,
    'productName' => 'CLT60 C 3(20-20-20)V/V/5000/7000',
    'qrCode' => 'P100022342',
    'date' => '2021-09-20',
    'qnt' => 11.,
    'unitLabel' => 'M3',
]);

$printer = Yii::createObject([
    'class' => D3PrinterGodex5000::class,
    'printerIp' => '192.168.88.228',
]);

$printer->check();

echo $printer->getCheckResponseCode() . PHP_EOL;
echo $printer->getCheckResponseLabel() . PHP_EOL;

$printer->print($label);
```

usage in a project
------------------

[](#usage-in-a-project)

- create an extended printer a component for creating printable files an in spool directory
- - defined printer connection details
- - create and save files for printing in the spool directory
- - method print() for spooler print demon
- demon for reading files from the spool directory and send to printer using FtpPrintDaemonController

Health monitoring
-----------------

[](#health-monitoring)

Define health component in app console config

```
    'kaltePrinterHealth' => [
            'class' => '\d3yii2\d3printer\components\D3Printer',
            'printerCode' => 'officePrinter',
            'printerName' => 'Godex G500',
            'accessSettings' => [
                'home_url' => '',
            ],
        ],
```

Read and save current state (files are located at \[app path\]/runtime/d3printer/\[printerCode\]

```
     /usr/bin/php /yii d3printer/health-cron
```

Define printer state panels in app main config

```
'panels' => [
    'printers' =>
        [
            [
                'route' => '/d3printer/info-panel/status',
                'params' => [
                    'printerComponent' => 'officePrinter',
                    'healthComponent' => 'officePrinterHealth',
                ]
            ],
            [
                'route' => '/d3printer/info-panel/status',
                'params' => [
                    'printerComponent' => 'homePrinter',
                    'healthComponent' => 'homePrinterHealth',
                ]
            ],
```

Show the state panel in app view

```
PanelWidget::widget(['name' => 'printers'])
```

Examples
--------

[](#examples)

Get printer status, cartridge and drum by printer code

```
 $printerComponent = D3Printer::getPrinterComponent('officePrinter');
 $deviceHealth = $printerComponent->deviceHealth();

 $status = $deviceHealth->getStatus();
 $cartridgeRemaining = $deviceHealth->getCartridgeRemaining();
 $drumRemaining = $deviceHealth->getDrumRemaining();
```

Demons for spool printer
------------------------

[](#demons-for-spool-printer)

### directory

[](#directory)

/usr/lib/systemd/system

```
[Unit]
Description=Cewood Maza Pecapstrade printer spooler

[Service]
User=www-data
TimeoutStartSec=30
Restart=on-failure
Restart=always
RestartSec=5s
# MpPrinter - printer compnent name
ExecStart=php /home/chroot/websites/cewood/yii d3printer/ftp-print-daemon MpPrinter
StandardOutput=append:/home/chroot/websites/cewood/runtime/logs/mp/printer-spooler.log
StandardError=append:/home/chroot/websites/cewood/runtime/logs/mp/printer-spooler-error.log
                     /home/chroot/websites/cewood/runtime/logs/mp/
SyslogIdentifier=MpPrintDeamon

[Install]
WantedBy=multi-user.target
```

### install

[](#install)

```

systemctl enable cewood-mp-printer-spooler.service
systemctl daemon-reload
systemctl start cewood-mp-printer-spooler.service
```

### diagnostic

[](#diagnostic)

```
journalctl -u cewood-mp-printer-spooler.service
check logfile /home/chroot/websites/cewood/runtime/logs/mp/printer-spooler-error.log
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance57

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 67.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/542187ba859514d10d0952dca77df8ea889a9651b249d0b5b513da791fd2919b?d=identicon)[uldisn](/maintainers/uldisn)

---

Top Contributors

[![uldisn](https://avatars.githubusercontent.com/u/3525344?v=4)](https://github.com/uldisn "uldisn (96 commits)")[![anothersoftware-lv](https://avatars.githubusercontent.com/u/9327511?v=4)](https://github.com/anothersoftware-lv "anothersoftware-lv (36 commits)")[![rokorolov](https://avatars.githubusercontent.com/u/6349248?v=4)](https://github.com/rokorolov "rokorolov (11 commits)")

### Embed Badge

![Health badge](/badges/d3yii2-d3printer/health.svg)

```
[![Health](https://phpackages.com/badges/d3yii2-d3printer/health.svg)](https://phpackages.com/packages/d3yii2-d3printer)
```

###  Alternatives

[robertmarney/lara-hierarchial-collections

Transforms flat collections to a nested hierarchy

342.2k](/packages/robertmarney-lara-hierarchial-collections)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
