PHP script specifically for generating ISBN and ISSN barcodes.
It could be used to generate other EAN-13 barcodes too, though not designed to do so.
You could either download everything in src/
into your project, or install via composer:
composer require sqkhor/publication-barcode
use \SQKhor\Barcode\PublicationBarcode;
// ISBN
$barcode = new PublicationBarcode('978-967-2088-62-2');
$svg = $barcode->render('svg');
// ISBN with add on
$barcode = new PublicationBarcode('978-967-2088-62-2', '50999');
$png = $barcode->render('svg');
// ISSN with issue number
$barcode = new PublicationBarcode('3009-1004', '01');
$svg = $barcode->svg();
new PublicationBarcode(code, [addon])
code (string)
The 13-digit ISBN / ISSN, or 8-digit ISSN code
addon (?string)
Supplimentary barcode data for price (ISBN) and issue number (ISSN)
render(format)
format (string)
Either one of these: svg | png | jpg | jpeg
$barcode = new PublicationBarcode('978-967-2088-62-2');
$svg = $barcode->svg();
$png = $barcode->png();
$jpg = $barcode->jpg();
- PNG / JPG render capability
- Class parameters to set bar width & height
- Reset after every use
- Error handling
- Comments / documentations
- Tests