{"id":36998185,"url":"https://github.com/griffithben/php-barcode-generator","last_synced_at":"2026-01-13T23:58:27.938Z","repository":{"id":62496942,"uuid":"207467219","full_name":"griffithben/php-barcode-generator","owner":"griffithben","description":"This is an easy to use, non-bloated, framework independent, barcode generator in PHP.  An updated version of `picqer/php-barcode-generator`","archived":false,"fork":false,"pushed_at":"2020-05-04T02:47:25.000Z","size":152,"stargazers_count":0,"open_issues_count":9,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-13T12:56:00.342Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/griffithben.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-10T04:43:59.000Z","updated_at":"2025-04-08T15:45:58.000Z","dependencies_parsed_at":"2022-11-02T11:45:44.281Z","dependency_job_id":null,"html_url":"https://github.com/griffithben/php-barcode-generator","commit_stats":null,"previous_names":["griffithben/php-barcode-generator"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/griffithben/php-barcode-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/griffithben%2Fphp-barcode-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/griffithben%2Fphp-barcode-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/griffithben%2Fphp-barcode-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/griffithben%2Fphp-barcode-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/griffithben","download_url":"https://codeload.github.com/griffithben/php-barcode-generator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/griffithben%2Fphp-barcode-generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28406118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-13T23:58:27.399Z","updated_at":"2026-01-13T23:58:27.916Z","avatar_url":"https://github.com/griffithben.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \u003cimg src=\"https://user-images.githubusercontent.com/632330/57006043-fb823800-6ba2-11e9-8fa9-eba94b8011b5.png\" width=\"30px\"/\u003e  PHP Barcode Generator\u003cbr/\u003e[![Build Status](https://travis-ci.org/brewerwall/php-barcode-generator.svg?branch=master)](https://travis-ci.org/brewerwall/php-barcode-generator) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/767119e854d7443b87a37ebc93697a42)](https://www.codacy.com/manual/Brewerwall/php-barcode-generator?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=brewerwall/php-barcode-generator\u0026amp;utm_campaign=Badge_Grade)\nThis is an easy to use, non-bloated, framework independent, barcode generator in PHP.  This version has been updated to follow PSR-4 and work with PHP 7.1+.\n\nIt creates SVG, PNG, JPG and HTML images, from the most used 1D barcode standards.\n\n*The codebase is largely from the [TCPDF barcode generator](https://github.com/tecnickcom/TCPDF) by Nicola Asuni. This code is therefor licensed under LGPLv3. It is still a bit of a mess, bit I will clean it in the future. I do not expect the interface of this class will change during the clean ups.*\n\n*This codebase, also extending off of [TCPDF barcode generator](https://github.com/tecnickcom/TCPDF) is a mostly direct copy from [Picqer barcode generator](https://github.com/picqer/php-barcode-generator).  Updated to be php 7.1+ compliant.*\n\n## Installation\nInstall through [composer](https://getcomposer.org/doc/00-intro.md):\n\n```\ncomposer require brewerwall/php-barcode-generator\n```\n\nIf you want to generate PNG or JPG images, you need the GD library or Imagick installed on your system as well.\n\nUsing IMB Barcodes require `bcmath` extension to be installed as well.\n\n## Usage\nCreate a new barcode generator.  This will declare the code, the type of barcode and what format the code will be rendered.\n\n```php\n$generator = new BarcodeGenerator(BarcodeType::TYPE_CODE_128, BarcodeRender::RENDER_JPG);\n\n// Generate our code\n$generated = $generator-\u003egenerate('012345678');\n\n// Generates the same code with style updates\n$generated = $generator-\u003egenerate('012345678', 4, 50, '#FFCC33');\n```\n\nThe `$generator-\u003egenerate()` method accepts the following parameters:\n- `$code` Barcode value we need to generate.\n- `$widthFactor` (default: 2) Width is based on the length of the data, with this factor you can make the barcode bars wider than default\n- `$totalHeight` (default: 30) The total height of the barcode\n- `$color` (default: #000000) Hex code of the foreground color\n\n## Image types\n```php\nuse Brewerwall\\Barcode\\Constants\\BarcodeRender;\n\nBarcodeRender::RENDER_JPG\nBarcodeRender::RENDER_PNG\nBarcodeRender::RENDER_HTML\nBarcodeRender::RENDER_SVG\n```\n\n## Accepted types\n```php\nuse Brewerwall\\Barcode\\Constants\\BarcodeType;\n\nBarcodeType::TYPE_CODE_39\nBarcodeType::TYPE_CODE_39_CHECKSUM\nBarcodeType::TYPE_CODE_39E\nBarcodeType::TYPE_CODE_39E_CHECKSUM\nBarcodeType::TYPE_CODE_93\nBarcodeType::TYPE_STANDARD_2_5\nBarcodeType::TYPE_STANDARD_2_5_CHECKSUM\nBarcodeType::TYPE_INTERLEAVED_2_5\nBarcodeType::TYPE_INTERLEAVED_2_5_CHECKSUM\nBarcodeType::TYPE_CODE_128\nBarcodeType::TYPE_CODE_128_A\nBarcodeType::TYPE_CODE_128_B\nBarcodeType::TYPE_CODE_128_C\nBarcodeType::TYPE_EAN_2\nBarcodeType::TYPE_EAN_5\nBarcodeType::TYPE_EAN_8\nBarcodeType::TYPE_EAN_13\nBarcodeType::TYPE_UPC_A\nBarcodeType::TYPE_UPC_E\nBarcodeType::TYPE_MSI\nBarcodeType::TYPE_MSI_CHECKSUM\nBarcodeType::TYPE_POSTNET\nBarcodeType::TYPE_PLANET\nBarcodeType::TYPE_RMS4CC\nBarcodeType::TYPE_KIX\nBarcodeType::TYPE_IMB\nBarcodeType::TYPE_CODABAR\nBarcodeType::TYPE_CODE_11\nBarcodeType::TYPE_PHARMA_CODE\nBarcodeType::TYPE_PHARMA_CODE_TWO_TRACKS\n```\n\n## Examples\nEmbedded PNG image in HTML:\n\n```php\n$generator = new BarcodeGenerator(BarcodeType::TYPE_CODE_128, BarcodeRender::RENDER_PNG);\necho '\u003cimg src=\"data:image/png;base64,' . base64_encode($generator-\u003egenerate('012345678')) . '\"\u003e';\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgriffithben%2Fphp-barcode-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgriffithben%2Fphp-barcode-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgriffithben%2Fphp-barcode-generator/lists"}