PHPackages                             elminson/barcode - 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. [Image &amp; Media](/categories/media)
4. /
5. elminson/barcode

ActiveLibrary[Image &amp; Media](/categories/media)

elminson/barcode
================

Generate barcode img

v0.4.0(7y ago)8743[5 issues](https://github.com/elminson/barcode/issues)MITPHP

Since Sep 16Pushed 7y ago1 watchersCompare

[ Source](https://github.com/elminson/barcode)[ Packagist](https://packagist.org/packages/elminson/barcode)[ RSS](/packages/elminson-barcode/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (5)Dependencies (5)Versions (6)Used By (0)

BarCode
=======

[](#barcode)

This script that generates barcodes in four barcode formats including Code 128, Code 39, Code 2of5, and Codabar. the options of “vertical” or “horizontal” display, varying barcode heights, and one of four barcode formats.

#### Require

[](#require)

PHP GD Library

#### Installation

[](#installation)

`composer require elminson/barcode`

#### Basic use:

[](#basic-use)

```
namespace Elminson\BarCode;

require_once(__DIR__ . '/vendor/autoload.php');

$barcode = new BarCode('code128');
$barcode->setText("Testing");
$barcode->setPrint(true);
$barcode->setTextColor("#ff9900");
$barcode->setBgColor("#cccccc");
$barcode->setFileName("test");
$barcode->setFilepath(__DIR__."/temp/");
$barcode->generate();
$barcode->SaveBarcodeToDisk();
$bardode->DestroyBarcode();
```

### Setters

[](#setters)

- setText =&gt; text to be converte to barcode
- setPrint =&gt; Show the text in the barcode
- setBgColor =&gt; Set the barcode Background (Default white)
- setTextColor =&gt; (Default Black)
- setFileNmae =&gt; Name for the image (if empty will generate a random number)
- setFilePath =&gt; Path to save the image(if empty will show the image)
- setOrientation =&gt; horizontal/vertical
- setCode\_type
- setSizeFactor
- setSize =&gt; Set text font size
- SaveBarcodeToDisk =&gt; Save Barcode
- GetPngData
- DrawBarcodeToScreen
- DestroyBarcode

### Examples

[](#examples)

Code128 [![Codabar](https://github.com/elminson/barcode/raw/master/temp/code128.png)](https://github.com/elminson/barcode/blob/master/temp/code128.png)

Code128C [![Codabar](https://github.com/elminson/barcode/raw/master/temp/code128c.png)](https://github.com/elminson/barcode/blob/master/temp/code128c.png)

Code128B [![Codabar](https://github.com/elminson/barcode/raw/master/temp/code128b.png)](https://github.com/elminson/barcode/blob/master/temp/code128b.png)

Code28A [![Codabar](https://github.com/elminson/barcode/raw/master/temp/code128a.png)](https://github.com/elminson/barcode/blob/master/temp/code128a.png)

Code39 [![Codabar](https://github.com/elminson/barcode/raw/master/temp/code39.png)](https://github.com/elminson/barcode/blob/master/temp/code39.png)

Code25 [![Codabar](https://github.com/elminson/barcode/raw/master/temp/code25.png)](https://github.com/elminson/barcode/blob/master/temp/code25.png)

Codabar [![Codabar](https://github.com/elminson/barcode/raw/master/temp/codabar.png)](https://github.com/elminson/barcode/blob/master/temp/codabar.png)

```
php-barcode
===========

Source code for the article "How To Create Barcodes in PHP" found at:
http://davidscotttufts.com/2009/03/31/how-to-create-barcodes-in-php/

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance8

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

5

Last Release

2798d ago

### Community

Maintainers

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

---

Top Contributors

[![elminson](https://avatars.githubusercontent.com/u/2476286?v=4)](https://github.com/elminson "elminson (15 commits)")

---

Tags

imagebarcode

### Embed Badge

![Health badge](/badges/elminson-barcode/health.svg)

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1714.8k8](/packages/2lenet-crudit-bundle)[mediamonks/sonata-media-bundle

A powerful, flexible and easy to use alternative for the existing Sonata Media Bundle

109.8k](/packages/mediamonks-sonata-media-bundle)

PHPackages © 2026

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