PHP Class Zebra\Client

Show file Open project: robgridley/zebra

Protected Properties

Property Type Description
$socket resource The endpoint.

Public Methods

Method Description
__construct ( string $host, integer $port = 9100 ) Create an instance.
__destruct ( ) Destroy an instance.
printer ( string $host, integer $port = 9100 ) : self Create an instance statically.
send ( string $zpl ) Send ZPL data to printer.

Protected Methods

Method Description
connect ( string $host, integer $port ) : boolean Connect to printer.
disconnect ( ) Close connection to printer.
getLastError ( ) : array Get the last socket error.

Method Details

__construct() public method

Create an instance.
public __construct ( string $host, integer $port = 9100 )
$host string
$port integer

__destruct() public method

Destroy an instance.
public __destruct ( )

connect() protected method

Connect to printer.
protected connect ( string $host, integer $port ) : boolean
$host string
$port integer
return boolean

disconnect() protected method

Close connection to printer.
protected disconnect ( )

getLastError() protected method

Get the last socket error.
protected getLastError ( ) : array
return array

printer() public static method

Create an instance statically.
public static printer ( string $host, integer $port = 9100 ) : self
$host string
$port integer
return self

send() public method

Send ZPL data to printer.
public send ( string $zpl )
$zpl string

Property Details

$socket protected property

The endpoint.
protected resource $socket
return resource