PHPackages                             charlieuki/receiptprinter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. charlieuki/receiptprinter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

charlieuki/receiptprinter
=========================

:description

1.2.5a(4y ago)15140.3k↓43.4%49[7 issues](https://github.com/charlieuki/receipt-printer/issues)[1 PRs](https://github.com/charlieuki/receipt-printer/pulls)MITPHPCI failing

Since Mar 28Pushed 2y ago6 watchersCompare

[ Source](https://github.com/charlieuki/receipt-printer)[ Packagist](https://packagist.org/packages/charlieuki/receiptprinter)[ Docs](https://github.com/charlieuki/receiptprinter)[ RSS](/packages/charlieuki-receiptprinter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (6)Versions (12)Used By (0)

Laravel Receipt Printer
=======================

[](#laravel-receipt-printer)

[![Latest Version on Packagist](https://camo.githubusercontent.com/57a0e7c1cb7049c927f5c29e16696fbaf258e62550cfdb31aa91cd689cc5dfbb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636861726c6965756b692f726563656970747072696e7465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/charlieuki/receiptprinter)[![Total Downloads](https://camo.githubusercontent.com/a3da27c995162aee859b6c5ec6777d0893186739468213db9e68b64a56a45bd4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636861726c6965756b692f726563656970747072696e7465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/charlieuki/receiptprinter)[![Build Status](https://camo.githubusercontent.com/e774ba7ebead33943f02f6c201f592f3adce683da0f2fd373d0c7fff8e925918/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636861726c6965756b692f726563656970747072696e7465722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/charlieuki/receiptprinter)[![StyleCI](https://camo.githubusercontent.com/cb13a877afd1dbe223c631789c3f922d3ace958fdb334a9cce9b26afefbc2ebd/68747470733a2f2f7374796c6563692e696f2f7265706f732f31323334353637382f736869656c64)](https://styleci.io/repos/12345678)

Simple Laravel package to integrate ESC/POS Print Driver for PHP.

Installation
------------

[](#installation)

Via Composer

```
$ composer require charlieuki/receiptprinter
```

Sample App
----------

[](#sample-app)

I have set up [a simple app](https://github.com/charlieuki/receipt-printer-example) based on Laravel 7 to serve as a demo.

Usage
-----

[](#usage)

Execute the following command to publish the config used by this package:

```
$ php artisan vendor:publish --tag=receiptprinter.config

```

Edit the config file located at `config/receiptprinter.php` as follows:

1. Set `connector_type` to:
    - `windows` if you are using Windows as your web server.
    - `cups` if you are using Linux or Mac as your web server.
    - `network` if you are using a network printer.
2. Set `connector_descriptor` to:
    - the printer name if your `connector_type` is either `windows` or `cups`
    - the IP address or Samba URI, e.g: `smb://192.168.0.5/PrinterName` if your `connector_type` is `network`
3. Set `connector_port` to the open port for the printer, only if your `connector_type` is `network`

Include the library:

```
use charlieuki\ReceiptPrinter\ReceiptPrinter as ReceiptPrinter;

```

Then use any one of these two functions to send "print" command to the printer.

```
printReceipt()

```

```
printRequest()

```

Example (Print Receipt)
-----------------------

[](#example-print-receipt)

```
use charlieuki\ReceiptPrinter\ReceiptPrinter as ReceiptPrinter;

...

// Set params
$mid = '123123456';
$store_name = 'YOURMART';
$store_address = 'Mart Address';
$store_phone = '1234567890';
$store_email = 'yourmart@email.com';
$store_website = 'yourmart.com';
$tax_percentage = 10;
$transaction_id = 'TX123ABC456';
$currency = 'Rp';
$image_path = 'logo.png';

// Set items
$items = [
    [
        'name' => 'French Fries (tera)',
        'qty' => 2,
        'price' => 65000,
    ],
    [
        'name' => 'Roasted Milk Tea (large)',
        'qty' => 1,
        'price' => 24000,
    ],
    [
        'name' => 'Honey Lime (large)',
        'qty' => 3,
        'price' => 10000,
    ],
    [
        'name' => 'Jasmine Tea (grande)',
        'qty' => 3,
        'price' => 8000,
    ],
];

// Init printer
$printer = new ReceiptPrinter;
$printer->init(
    config('receiptprinter.connector_type'),
    config('receiptprinter.connector_descriptor')
);

// Set store info
$printer->setStore($mid, $store_name, $store_address, $store_phone, $store_email, $store_website);

// Set currency
$printer->setCurrency($currency);

// Add items
foreach ($items as $item) {
    $printer->addItem(
        $item['name'],
        $item['qty'],
        $item['price']
    );
}
// Set tax
$printer->setTax($tax_percentage);

// Calculate total
$printer->calculateSubTotal();
$printer->calculateGrandTotal();

// Set transaction ID
$printer->setTransactionID($transaction_id);

// Set logo
// Uncomment the line below if $image_path is defined
//$printer->setLogo($image_path);

// Set QR code
$printer->setQRcode([
    'tid' => $transaction_id,
]);

// Print receipt
$printer->printReceipt();

```

Example (Print Request)
-----------------------

[](#example-print-request)

```
use charlieuki\ReceiptPrinter\ReceiptPrinter as ReceiptPrinter;

...

// Set params
$mid = '123123456';
$store_name = 'YOURMART';
$store_address = 'Mart Address';
$store_phone = '1234567890';
$store_email = 'yourmart@email.com';
$store_website = 'yourmart.com';
$tax_percentage = 10;
$transaction_id = 'TX123ABC456';
$currency = 'Rp';
$image_path = 'logo.png';

// Init printer
$printer = new ReceiptPrinter;
$printer->init(
    config('receiptprinter.connector_type'),
    config('receiptprinter.connector_descriptor')
);

// Set store info
$printer->setStore($mid, $store_name, $store_address, $store_phone, $store_email, $store_website);

// Set currency
$printer->setCurrency($currency);

// Set request amount
$printer->setRequestAmount($request_amount);

// Set transaction ID
$printer->setTransactionID($transaction_id);

// Set logo
// Uncomment the line below if $image_path is defined
//$printer->setLogo($image_path);

// Set QR code
$printer->setQRcode([
    'tid' => $transaction_id,
    'amount' => $request_amount,
]);

// Print payment request
$printer->printRequest();

```

Changelog
---------

[](#changelog)

Please see the [changelog](changelog.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

Problems
--------

[](#problems)

If you discover any issues, please post the details on the [issue tracker](https://github.com/charlieuki/receipt-printer/issues).

Credits
-------

[](#credits)

- *Mike42* for the awesome [PHP ESC/POS Print Driver](https://github.com/mike42/escpos-php "PHP ESC/POS Print Driver") library

License
-------

[](#license)

MIT. Please see the [license file](license.md) for more information.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity47

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 74.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~97 days

Recently: every ~74 days

Total

11

Last Release

1640d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/daad88c83de2fd0939718e201db3b408d92e9fb8bc9a0afe470579ad27bf67a1?d=identicon)[charlieuki](/maintainers/charlieuki)

---

Top Contributors

[![charlieuki](https://avatars.githubusercontent.com/u/45746232?v=4)](https://github.com/charlieuki "charlieuki (26 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![animaster](https://avatars.githubusercontent.com/u/2392133?v=4)](https://github.com/animaster "animaster (2 commits)")[![MustafaRaarujeed](https://avatars.githubusercontent.com/u/14356467?v=4)](https://github.com/MustafaRaarujeed "MustafaRaarujeed (2 commits)")

---

Tags

laravelReceiptPrinter

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/charlieuki-receiptprinter/health.svg)

```
[![Health](https://phpackages.com/badges/charlieuki-receiptprinter/health.svg)](https://phpackages.com/packages/charlieuki-receiptprinter)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[nedwors/navigator

A Laravel package to ease defining navigation menus

433.1k](/packages/nedwors-navigator)[xefi/faker-php-laravel

Faker php integration with laravel

1915.1k](/packages/xefi-faker-php-laravel)[dcblogdev/laravel-junie

Install pre-configured guides for Jetbrains Junie

392.5k](/packages/dcblogdev-laravel-junie)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
