pinekta/php-jp-customer-barcode-generator

This library 'php-jp-customer-barcode-generator' is an easy to use, framework independent, Japan post's customer barcode generator in PHP.

0.9.2 2019-08-31 07:14 UTC

This package is auto-updated.

Last update: 2024-04-29 04:26:52 UTC


README

Build status PHP Version Coverage Status Packagist Version License

This library 'php-jp-customer-barcode-generator' is an easy to use, framework independent, Japan post's customer barcode generator in PHP.

It creates Japan post's customer barcode by SVG, PNG, JPG and HTML images.

php-jp-customer-barcode-generator requires PHP >= 5.4.0.

Japanese README is here

Installation

composer require pinekta/php-jp-customer-barcode-generator

If you want to generate PNG or JPG images, you need the GD library or Imagick installed on your system as well.

Usage

<?php

// SVG
$generator = new Pinekta\JPCustomerBarcode\BarcodeGeneratorSVG();
echo $generator->getBarcode('104-0045', '東京都中央区築地2-3-4');

// HTML
$generator = new Pinekta\JPCustomerBarcode\BarcodeGeneratorHTML();
echo $generator->getBarcode('104-0045', '東京都中央区築地2-3-4');

// PNG
$generator = new Pinekta\JPCustomerBarcode\BarcodeGeneratorPNG();
echo '<img src="data:image/png;base64,' . base64_encode($generator->getBarcode('104-0045', '東京都中央区築地2-3-4')) . '">');

// JPG
$generator = new Pinekta\JPCustomerBarcode\BarcodeGeneratorJPG();
echo '<img src="data:image/jpg;base64,' . base64_encode($generator->getBarcode('104-0045', '東京都中央区築地2-3-4')) . '">');

Generated customer barcode

SVG

SVG

HTML

HTML

PNG

PNG

JPG

JPG

Result about Japan post check sheet

Please check below link.
result

Contributing

Contributions are welcome! This project adheres to a Contributor Code of Conduct. By participating in this project and its community, you are expected to uphold this code. Please read CONTRIBUTING for details.

Copyright

The pinekta/php-jp-customer-barcode-generator is copyright © @pinekta.

License

The pinekta/php-jp-customer-barcode-generator is licensed under the MIT License. Please see LICENSE for more information.