Easily print labels with a Brother label printer.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.editorconfig
.gitattributes
.gitignore
.scrutinizer.yml
.styleci.yml
.travis.yml
CONDUCT.md
CONTRIBUTING.md
LICENSE.md
README.md
composer.json
composer.lock
phpunit.xml.dist

README.md

Label Printer

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

This library is a WIP.

Easily print labels with a Brother label printer. This library is tested with the Brother QL-720NW.

Install

Composer

$ composer require RamyTalal/Label-Printer

Usage

ESC/P

use Talal\LabelPrinter\Printer;
use Talal\LabelPrinter\Mode\Escp;
use Talal\LabelPrinter\Command;

$stream = stream_socket_client('tcp://192.168.1.8:9100', $errorNumber, $errorString);

$printer = new Printer(new Escp($stream));
$font = new Command\Font('brussels', Command\Font::TYPE_OUTLINE);

$printer->addCommand(new Command\CharStyle(Command\CharStyle::NORMAL));
$printer->addCommand($font);
$printer->addCommand(new Command\CharSize(46, $font));
$printer->addCommand(new Command\Align(Command\Align::CENTER));
$printer->addCommand(new Command\Text('Hallo'));
$printer->addCommand(new Command\Cut(Command\Cut::FULL));
$printer->printLabel();

fclose($stream);

Template

use Talal\LabelPrinter\Printer;
use Talal\LabelPrinter\Mode\Template;
use Talal\LabelPrinter\Command;

$stream = stream_socket_client('tcp://192.168.1.8:9100', $errorNumber, $errorString);

$printer = new Printer(new Template(2, $stream));
$printer->addCommand(new Command\Object('title', 'R. Talal'));
$printer->addCommand(new Command\Object('address', 'H.H. Schefferlaan 9'));
$printer->addCommand(new Command\Object('postalcode', '7771 CW'));
$printer->addCommand(new Command\Object('city', 'Hardenberg'));

$printer->printLabel();

fclose($stream);

Testing

$ composer test

TODO

  • Documentation
  • Generating QR Codes

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email ramy@thinkquality.nl instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.