Download the PHP package blutrixx/nativephp-escpos-printer without Composer

On this page you can find all versions of the php package blutrixx/nativephp-escpos-printer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package nativephp-escpos-printer

Blutrixx ESC/POS Printer

A NativePHP Mobile plugin for talking to Bluetooth ESC/POS thermal receipt printers — connect, print formatted text with an optional logo, and get notified of connection/print state via native events.

Composer package: blutrixx/nativephp-escpos-printer Repo: joelnjoshkibona/nativephp-escpos-printer Current release: v1.0.0

Requirements

Installation

Not on Packagist yet.

As a git submodule (how this repo itself consumes it):

Without a submodule:

Laravel auto-discovers EscPosPrinterServiceProvider.

How the bridge works

Unlike blutrixx/nativephp-device-utils, every method on this package's facade is synchronous — connect, print, and status checks all block and return a real result, no native-event listening required. Internally each call goes through nativephp_call() with JSON-encoded params and a JSON-decoded response.

Three native events still exist for cases where you want to react to connection state changing outside a direct method call (e.g. the printer disconnecting mid-session) — listen for these the same way described in blutrixx/nativephp-device-utils' README if you need them.

Logo printing — you must configure your own logo

print() and testPrint() support a {{LOGO}} or {{LOGO:filename.png}} placeholder inside the ESC/POS command string, which gets swapped for the actual printed bitmap. This package ships no default logo asset — that's deliberate. It used to (an earlier, single-app version of this plugin hardcoded one brand's logo as the default), but a shared plugin can't sensibly default to any one app's branding, so:

  1. Publish the config: php artisan vendor:publish --tag=escpos-printer-config
  2. Bundle your own logo image into your app's own native build assets (this package doesn't manage that for you — it only resolves a filename at print time; getting that file onto the device is your app's asset pipeline).
  3. Point config/escpos-printer.php's default_logo (or the ESCPOS_PRINTER_DEFAULT_LOGO env var) at that filename, or always pass it explicitly:

If neither an explicit filename nor a configured default is available, the {{LOGO}} line is silently dropped from the print job — the receipt still prints, just without a logo, rather than falling back to any particular app's image.

API reference

Method Returns Notes
checkPermissions() array Bluetooth permission status
requestPermissions() array Prompts for the Bluetooth permission
connect() array Connects to the first bonded Bluetooth printer found
disconnect() array
isConnected() bool
getPrinters() array List of bonded Bluetooth devices
ensureConnected() array Connects only if not already connected — safe to call before every print
print(string $commands) array Connects first if needed, resolves any {{LOGO}} placeholder, strips empty <img></img> tags, then prints
testPrint() array Prints a test receipt
processLogoInCommands(string $commands) string Resolves a {{LOGO}}/{{LOGO:file.png}} placeholder to hex; called automatically by print()
convertLogo(string $filename) array Converts an image (from your app's bundled assets) to an ESC/POS hex string — {hex: string} on success

Events

All under Blutrixx\EscPosPrinter\Events\*: PrinterConnected, PrinterDisconnected, PrintCompleted, PrintFailed.

Android manifest

The plugin only talks to already-bonded printers (no discovery), so BLUETOOTH_SCAN and the location permissions are not declared. The Bluetooth hardware feature is declared required: false, so the app still installs on devices without Bluetooth; printing simply fails there.

Quick start


All versions of nativephp-escpos-printer with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
nativephp/mobile Version ^4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package blutrixx/nativephp-escpos-printer contains the following files

Loading the files please wait ...