Printing Brother labels with PHP

I've created a PHP library which allows me to print Brother labels without having to install the Brother P-Touch application. The library could be used to automate the printing of shipping labels as part of a webshop workflow.

Sample usage

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

$stream = stream_socket_client('tcp://', $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(new Command\CharSize(46, $font));
$printer->addCommand(new Command\Align(Command\Align::CENTER));
$printer->addCommand(new Command\Text('Hello'));
$printer->addCommand(new Command\Cut(Command\Cut::FULL));


You can find the library at

Ramy Talal

Read more posts by this author.