Skip to content

Commit

Permalink
Merge pull request #803 from mike42/development
Browse files Browse the repository at this point in the history
Changes for release v3.0
  • Loading branch information
mike42 committed Oct 13, 2019
2 parents e5496cf + 203c53e commit dcb569a
Show file tree
Hide file tree
Showing 93 changed files with 2,250 additions and 1,206 deletions.
9 changes: 2 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,19 @@ sudo: required
language: php

php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- nightly
- hhvm-3.21
- hhvm-nightly

matrix:
allow_failures:
- php: nightly
- php: hhvm-nightly

before_install:
- sudo apt-get -qq update
- sudo apt-get install -y imagemagick ghostscript
- sudo apt-get install -y imagemagick ghostscript unifont

install:
- composer install
Expand Down
44 changes: 15 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,43 +165,27 @@ If you use any other printer with this code, please [let us know](https://github
### Include the library

#### Composer
If you are using composer, then add `mike42/escpos-php` as a dependency:

```bash
composer require mike42/escpos-php
```

In this case, you would include composer's auto-loader at the top of your source files:

```php
<?php
require __DIR__ . '/vendor/autoload.php';
```

#### Manually
If you don't have composer available, then simply download the code and include `autoload.php`:
This library is designed for use with the `composer` PHP dependency manager. Simply add the `mike42/escpos-php` package to get started:

```bash
git clone https://github.com/mike42/escpos-php vendor/mike42/escpos-php
composer require mike42/escpos-php
```

```php
<?php
require __DIR__ . '/vendor/mike42/escpos-php/autoload.php';
```
If you haven't used `composer` before, you can read about it at [getcomposer.org](https://getcomposer.org/).

#### Requirements

To maintain compatibility with as many systems as possible, this driver has few
hard dependencies:
This project has few hard dependencies:

- PHP 5.4 or above.
- `mbstring` extension, since the driver accepts UTF-8 encoding.
- PHP 7.0 or newer.
- `json` extension, used to load bundled printer definitions (see [documentation](https://www.php.net/manual/en/book.json.php))
- `intl` extension, used for character encoding (see [documentation](https://www.php.net/manual/en/book.intl.php))
- `zlib` extension, used for de-compressing bundled resources (see [documentation](https://www.php.net/manual/en/book.zlib.php)).

It is also suggested that you install either `imagick` or `gd`, so that you can
print images.
It is also suggested that you install either `imagick` or `gd`, as these can be used to speed up image processing.

A number of optional packages can be added to enable more specific features. These
A number of optional extensions can be added to enable more specific features. These
are described in the "suggest" section of [composer.json](https://github.com/mike42/escpos-php/tree/master/composer.json).

### The 'Hello World' receipt
Expand Down Expand Up @@ -272,14 +256,15 @@ try {
```

While a serial printer might use:

```php
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
use Mike42\Escpos\Printer;
$connector = new FilePrintConnector("/dev/ttyS0");
$printer = new Printer($connector);
```

For each OS/interface combination that's supported, there are examples in the compatibility section of how a `PrintConnector` would be constructed. If you can't get a `PrintConnector` to work, then be sure to include the working print command in bug.
For each OS/interface combination that's supported, there are examples in the compatibility section of how a `PrintConnector` would be constructed. If you can't get a `PrintConnector` to work, then be sure to include the working print command in your issue.

### Using a CapabilityProfile

Expand Down Expand Up @@ -308,6 +293,7 @@ $printer = new Printer($connector, $profile);
For a list of available profiles, or to have support for your printer improved, please see the upstream [receipt-print-hq/escpos-printer-db](https://github.com/receipt-print-hq/escpos-printer-db) project.

### Tips & examples

On Linux, your printer device file will be somewhere like `/dev/lp0` (parallel), `/dev/usb/lp1` (USB), `/dev/ttyUSB0` (USB-Serial), `/dev/ttyS0` (serial).

On Windows, the device files will be along the lines of `LPT1` (parallel) or `COM1` (serial). Use the `WindowsPrintConnector` to tap into system printing on Windows (eg. [Windows USB](https://github.com/mike42/escpos-php/tree/master/example/interface/windows-usb.php), [SMB](https://github.com/mike42/escpos-php/tree/master/example/interface/smb.php) or [Windows LPT](https://github.com/mike42/escpos-php/tree/master/example/interface/windows-lpt.php)) - this submits print jobs via a queue rather than communicating directly with the printer.
Expand Down Expand Up @@ -564,9 +550,9 @@ Posts I've written up for people who are learning how to use receipt printers:

This code is MIT licensed, and you are encouraged to contribute any modifications back to the project.

For development, it's suggested that you load `imagick`, `gd` and `Xdebug` PHP exensions, and install `composer`.
For development, it's suggested that you load `imagick`, `gd` and `Xdebug` PHP extensions.

The tests are executed on [Travis CI](https://travis-ci.org/mike42/escpos-php) over PHP 5.4, 5.5, 5.6, 7.0, 7.1 and 7.2, plus the latest LTS version of HHVM, 3.21. Older versions of PHP are not supported in current releases.
The tests are executed on [Travis CI](https://travis-ci.org/mike42/escpos-php) over PHP 7.0, 7.1, 7.2 and 7.3. Older versions of PHP are not supported in current release, nor is HHVM.

Fetch a copy of this code and load dependencies with composer:

Expand Down
26 changes: 0 additions & 26 deletions autoload.php

This file was deleted.

78 changes: 42 additions & 36 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,44 @@
{
"name": "mike42/escpos-php",
"type": "library",
"description": "PHP receipt printer library for use with ESC/POS-compatible thermal and impact printers",
"homepage": "https://github.com/mike42/escpos-php",
"keywords": ["receipt", "print", "escpos", "ESC-POS", "driver"],
"license": "MIT",
"authors": [
{
"name": "Michael Billington",
"email": "[email protected]"
}
],
"config": {
"platform": {
"php": "5.4.0"
}
},
"require": {
"php": ">=5.4.0",
"ext-mbstring": "*"
},
"suggest": {
"guzzlehttp/guzzle": "Allows the use of the ApiConnector to send print jobs over HTTP.",
"ext-imagick": "Will be used for image printing if present. Required for PDF printing or use of custom fonts.",
"ext-gd": "Used for image printing if present."
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"squizlabs/php_codesniffer": "^3.2",
"guzzlehttp/guzzle": "^5.3"
},
"autoload": {
"psr-4": {
"Mike42\\": "src/Mike42"
}
}
"name" : "mike42/escpos-php",
"type" : "library",
"description" : "PHP receipt printer library for use with ESC/POS-compatible thermal and impact printers",
"homepage" : "https://github.com/mike42/escpos-php",
"keywords" : [
"barcode",
"epson",
"receipt-printer",
"printer",
"escpos"
],
"license" : "MIT",
"authors" : [{
"name" : "Michael Billington",
"email" : "[email protected]"
}
],
"config": {
"platform": {
"php": "7.0.0"
}
},
"require" : {
"php" : ">=7.0.0",
"ext-json": "*",
"ext-intl": "*",
"ext-zlib": "*",
"mike42/gfx-php" : "^0.6"
},
"suggest" : {
"ext-imagick" : "Will be used for image printing if present. Required for PDF printing or use of custom fonts.",
"ext-gd" : "Used for image printing if present."
},
"require-dev" : {
"phpunit/phpunit" : "^6.5",
"squizlabs/php_codesniffer" : "^3.3"
},
"autoload" : {
"psr-4" : {
"Mike42\\" : "src/Mike42"
}
}
}
Loading

0 comments on commit dcb569a

Please sign in to comment.