Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes for release v3.0 #803

Merged
merged 38 commits into from
Oct 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
023721d
Bump minimum HTTP version to 7.0, remove lesser-used autoload and Api…
mike42 Jun 30, 2018
13e96ca
remove old capability profile classes
mike42 Jun 30, 2018
66b2b7e
add php version to config to remove non- 7.0-compatible dependencies
mike42 Jun 30, 2018
2222d79
begin type hinting code
mike42 Jun 30, 2018
a849484
try hhvm in php7 mode
mike42 Jun 30, 2018
276da78
test if phan can be installed on supported versions
mike42 Jul 1, 2018
40dbc2f
Revert "test if phan can be installed on supported versions"
mike42 Jul 1, 2018
d7fecf6
type hint fixes, remove old classes
mike42 Jul 1, 2018
7578489
fix initialization in example
mike42 Jul 1, 2018
3bd096c
Merge branch 'master' of github.com:mike42/escpos-php into developmen…
mike42 Feb 19, 2019
94d7e6c
allow priting GIF and PNG via gfx-php
mike42 Feb 24, 2019
9bee843
add updide-down example
mike42 Feb 24, 2019
5085fac
Add MultiplePrintConnector #789
mike42 Oct 5, 2019
4c90fa0
Merge branch 'development' of github.com:mike42/escpos-php into devel…
mike42 Oct 5, 2019
ffe3050
remove hhvm, add 7.3
mike42 Oct 5, 2019
e548e4c
Merge pull request #802 from mike42/development-v3
mike42 Oct 5, 2019
8f14e3b
Merge branch 'development' of github.com:mike42/escpos-php into 789-m…
mike42 Oct 5, 2019
56620dc
update MultiplePrintConnectorTest for newer phpunit
mike42 Oct 5, 2019
8702f62
Merge pull request #799 from mike42/789-multiple-print-connector
mike42 Oct 5, 2019
b742e50
Merge branch 'master' into development
mike42 Oct 5, 2019
59a3deb
update gfx-php to 0.6, adding wbmp and bmp support
mike42 Oct 5, 2019
f60959f
add checks for failed tmp file creation, closes #362
mike42 Oct 5, 2019
5543a4c
Merge pull request #804 from mike42/576-gfx-php-version
mike42 Oct 5, 2019
77cfd89
Merge pull request #805 from mike42/362-mac-tmp-dir
mike42 Oct 5, 2019
5208522
update README for v3 #3
mike42 Oct 5, 2019
fde697b
Merge pull request #806 from mike42/576-documentation
mike42 Oct 5, 2019
51e1c9e
replace iconv and mbstring usage with intl extension
mike42 Oct 6, 2019
6b4215b
replace iconv with UConverter for ZJ printer textChinese() method
mike42 Oct 6, 2019
e920a0f
rename some methods
mike42 Oct 6, 2019
24fc7d0
re-implement code page handling using php-intl methods more effective…
mike42 Oct 6, 2019
9a7561c
updates from escpos-printer-db
mike42 Oct 6, 2019
67d00cd
fix minor issues
mike42 Oct 7, 2019
e10cfb0
Merge pull request #808 from mike42/807-intl
mike42 Oct 7, 2019
0dceee7
initial integration of unifont-based output
mike42 Oct 13, 2019
0a3bd56
Merge branch 'development' of github.com:mike42/escpos-php into 813-u…
mike42 Oct 13, 2019
ffe2eb4
update code point iteration, normalise text
mike42 Oct 13, 2019
e59b682
add unit test
mike42 Oct 13, 2019
203c53e
Merge pull request #814 from mike42/813-unifont
mike42 Oct 13, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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