PHPackages                             isahaq/barcode-qrcode-generator - 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. isahaq/barcode-qrcode-generator

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

isahaq/barcode-qrcode-generator
===============================

A Universal Barcode generator and QR Code generator for Laravel and PHP with multiple format support

v1.0.1(12mo ago)4503MITPHPPHP ^7.4|^8.0

Since Jun 26Pushed 12mo agoCompare

[ Source](https://github.com/isahaq1/BarcodeGeneratorPackage)[ Packagist](https://packagist.org/packages/isahaq/barcode-qrcode-generator)[ RSS](/packages/isahaq-barcode-qrcode-generator/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (5)Versions (3)Used By (0)

Barcode &amp; QR Code Generator for Laravel and PHP
===================================================

[](#barcode--qr-code-generator-for-laravel-and-php)

[![Banner](./banner.png)](./banner.png)

A comprehensive barcode and QR code generator package for Laravel and PHP applications. This package provides easy-to-use functionality for generating various types of barcodes and QR codes using TCPDF library.

Features
--------

[](#features)

- **Multiple Barcode Types**: Support for 30+ barcode types including Code 128, Code 39, EAN-13, UPC-A, and more
- **QR Code Generation**: Generate QR codes with customizable options using Endroid QR Code
- **Multiple Output Formats**: PNG, SVG, HTML, JPG, and PDF using TCPDF
- **Laravel Integration**: Service provider, facades, and Blade directives
- **Customizable Options**: Colors, sizes, margins, error correction levels
- **Comprehensive Testing**: Full test coverage with PHPUnit
- **Easy to Use**: Simple API for both Laravel and standalone PHP usage
- **No External Dependencies**: Uses only TCPDF and Endroid QR Code libraries

Installation
------------

[](#installation)

### Via Composer

[](#via-composer)

```
composer require isahaq/barcode-qrcode-generator
```

### For Laravel Applications

[](#for-laravel-applications)

The package will automatically register the service provider. If you're using Laravel 5.5+, the package will be auto-discovered.

For older Laravel versions, add the service provider to your `config/app.php`:

```
'providers' => [
    // ...
    Isahaq\BarcodeQrCode\BarcodeQrCodeServiceProvider::class,
],

'aliases' => [
    // ...
    'Barcode' => Isahaq\BarcodeQrCode\Facades\Barcode::class,
    'QRCode' => Isahaq\BarcodeQrCode\Facades\QRCode::class,
],
```

Publish the configuration file:

```
php artisan vendor:publish --provider="Isahaq\BarcodeQrCode\BarcodeQrCodeServiceProvider" --tag="barcode-qrcode-config"
```

Usage
-----

[](#usage)

### Laravel Usage

[](#laravel-usage)

#### Using Facades

[](#using-facades)

```
use Isahaq\BarcodeQrCode\Facades\Barcode;
use Isahaq\BarcodeQrCode\Facades\QRCode;

// Generate barcode
$barcodePNG = Barcode::generatePNG('C128', '123456789');
$barcodeSVG = Barcode::generateSVG('EAN13', '1234567890123');

// Generate QR code
$qrCodePNG = QRCode::generatePNG('https://example.com');
$qrCodeSVG = QRCode::generateSVG('Hello World');

// Save to file
Barcode::save('C128', '123456789', 'barcode.png', 'PNG');
QRCode::save('https://example.com', 'qrcode.png', 'PNG');
```

#### Using Dependency Injection

[](#using-dependency-injection)

```
use Isahaq\BarcodeQrCode\BarcodeGenerator;
use Isahaq\BarcodeQrCode\QRCodeGenerator;

class BarcodeController extends Controller
{
    public function generate(BarcodeGenerator $barcode, QRCodeGenerator $qrcode)
    {
        $barcodeImage = $barcode->generatePNG('C128', '123456789');
        $qrCodeImage = $qrcode->generatePNG('https://example.com');

        return response($barcodeImage)->header('Content-Type', 'image/png');
    }
}
```

#### Using Blade Directives

[](#using-blade-directives)

```

@barcode('C128', '123456789')

@qrcode('https://example.com')

@barcodePNG('C128', '123456789')

@qrcodePNG('https://example.com')
```

### Standalone PHP Usage

[](#standalone-php-usage)

```
require 'vendor/autoload.php';

use Isahaq\BarcodeQrCode\BarcodeGenerator;
use Isahaq\BarcodeQrCode\QRCodeGenerator;

// Initialize generators
$barcode = new BarcodeGenerator();
$qrcode = new QRCodeGenerator();

// Generate barcode
$barcodePNG = $barcode->generatePNG('C128', '123456789');

// Generate QR code
$qrCodePNG = $qrcode->generatePNG('https://example.com');

// Save to file
$barcode->save('C128', '123456789', 'barcode.png', 'PNG');
$qrcode->save('https://example.com', 'qrcode.png', 'PNG');
```

Configuration
-------------

[](#configuration)

The package configuration file (`config/barcode-qrcode.php`) allows you to customize default settings:

```
return [
    'barcode' => [
        'default_type' => 'C128',
        'default_options' => [
            'width' => 2,
            'height' => 30,
            'foreground_color' => [0, 0, 0],
            'background_color' => [255, 255, 255],
            'text' => true,
            'text_size' => 12,
            'text_position' => 'bottom',
            'padding' => 10
        ],
    ],

    'qrcode' => [
        'default_options' => [
            'size' => 300,
            'margin' => 10,
            'foreground_color' => [0, 0, 0],
            'background_color' => [255, 255, 255],
            'error_correction_level' => 'medium',
            'round_block_size_mode' => 'margin',
        ],
    ],
];
```

Barcode Types
-------------

[](#barcode-types)

The package supports the following barcode types (using TCPDF):

- **C39** - Code 39
- **C39+** - Code 39+
- **C39E** - Code 39 Extended
- **C39E+** - Code 39 Extended+
- **C93** - Code 93
- **S25** - Standard 2 of 5
- **S25+** - Standard 2 of 5+
- **I25** - Interleaved 2 of 5
- **I25+** - Interleaved 2 of 5+
- **C128** - Code 128
- **C128A** - Code 128 A
- **C128B** - Code 128 B
- **C128C** - Code 128 C
- **EAN2** - EAN 2
- **EAN5** - EAN 5
- **EAN8** - EAN 8
- **EAN13** - EAN 13
- **UPCA** - UPC-A
- **UPCE** - UPC-E
- **MSI** - MSI
- **MSI+** - MSI+
- **POSTNET** - POSTNET
- **PLANET** - PLANET
- **RMS4CC** - RMS4CC
- **KIX** - KIX
- **IMB** - IMB
- **CODABAR** - Codabar
- **CODE11** - Code 11
- **PHARMA** - Pharma Code
- **PHARMA2T** - Pharma Code Two-Track

QR Code Options
---------------

[](#qr-code-options)

QR codes support the following options (using Endroid QR Code):

- **size**: Size of the QR code (default: 300)
- **margin**: Margin around the QR code (default: 10)
- **foreground\_color**: Foreground color as RGB array (default: \[0, 0, 0\])
- **background\_color**: Background color as RGB array (default: \[255, 255, 255\])
- **error\_correction\_level**: Error correction level (low, medium, high, quartile)
- **round\_block\_size\_mode**: Round block size mode (margin, enlarge, shrink)
- **logo\_path**: Path to logo image to embed in QR code
- **logo\_size**: Size of the logo (default: 100)

Advanced Usage
--------------

[](#advanced-usage)

### Custom Options

[](#custom-options)

```
// Barcode with custom options
$options = [
    'width' => 3,
    'height' => 50,
    'foreground_color' => [255, 0, 0], // Red
    'background_color' => [255, 255, 255], // White
    'padding' => 20
];

$barcode = Barcode::generatePNG('C128', '123456789', $options);

// QR code with custom options
$options = [
    'size' => 400,
    'margin' => 20,
    'foreground_color' => [0, 0, 255], // Blue
    'background_color' => [255, 255, 255], // White
    'error_correction_level' => 'high',
    'round_block_size_mode' => 'enlarge'
];

$qrCode = QRCode::generatePNG('https://example.com', $options);
```

### Multiple Formats

[](#multiple-formats)

```
// Generate in multiple formats
$formats = ['PNG', 'SVG', 'HTML', 'JPG'];

foreach ($formats as $format) {
    $barcode = Barcode::generate($format, 'C128', '123456789');
    $qrCode = QRCode::generate($format, 'https://example.com');
}
```

### Validation

[](#validation)

```
// Check if barcode type is supported
if (Barcode::isValidType('C128')) {
    $barcode = Barcode::generatePNG('C128', '123456789');
}

// Check if QR code data is valid
if (QRCode::isValidData('https://example.com')) {
    $qrCode = QRCode::generatePNG('https://example.com');
}
```

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

Or with PHPUnit directly:

```
./vendor/bin/phpunit
```

Examples
--------

[](#examples)

### E-commerce Product Barcode

[](#e-commerce-product-barcode)

```
// Generate EAN-13 barcode for product
$productCode = '1234567890123';
$barcode = Barcode::generatePNG('EAN13', $productCode);

// Save to product images directory
Barcode::save('EAN13', $productCode, 'products/barcode.png', 'PNG');
```

### Contact QR Code

[](#contact-qr-code)

```
// Generate vCard QR code
$vCard = "BEGIN:VCARD\nVERSION:3.0\nFN:John Doe\nTEL:+1234567890\nEMAIL:john@example.com\nEND:VCARD";
$qrCode = QRCode::generatePNG($vCard);

// Save to contacts directory
QRCode::save($vCard, 'contacts/john_doe.png', 'PNG');
```

### URL QR Code with Logo

[](#url-qr-code-with-logo)

```
$options = [
    'size' => 400,
    'logo_path' => 'logo.png',
    'logo_size' => 80,
    'error_correction_level' => 'high'
];

$qrCode = QRCode::generatePNG('https://example.com', $options);
```

Dependencies
------------

[](#dependencies)

- **TCPDF**: For barcode generation in multiple formats
- **Endroid QR Code**: For QR code generation with advanced features

Contributing
------------

[](#contributing)

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests for new functionality
5. Run the test suite
6. Submit a pull request

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

Support
-------

[](#support)

For support, please open an issue on GitHub or contact the maintainer.

Changelog
---------

[](#changelog)

### v1.0.0

[](#v100)

- Initial release
- Support for 30+ barcode types using TCPDF
- QR code generation with custom options using Endroid QR Code
- Multiple output formats (PNG, SVG, HTML, JPG, PDF)
- Laravel integration with service provider and facades
- Blade directives
- Comprehensive test suite
- No external barcode library dependencies

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance50

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity43

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 ~11 days

Total

2

Last Release

362d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/11f213329a74dc5367c135ed69a8595ed2fc0709ca0617a99c4e39d342784a54?d=identicon)[isahaq](/maintainers/isahaq)

---

Top Contributors

[![isahaq1](https://avatars.githubusercontent.com/u/28819010?v=4)](https://github.com/isahaq1 "isahaq1 (25 commits)")

---

Tags

phpqrcodelaravelgeneratorbarcode

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/isahaq-barcode-qrcode-generator/health.svg)

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

###  Alternatives

[milon/barcode

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

1.5k14.4M55](/packages/milon-barcode)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[tuncaybahadir/quar

A simple QR Code generation tool for your projects with Laravel 10, 11, 12, 13 versions, php 8.2, 8.3, 8.4 and 8.5

79116.7k6](/packages/tuncaybahadir-quar)[robbiep/zbar-qrdecoder

A PHP wrapper for Zbar. Decodes images/photos containing QR codes.

3351.8k](/packages/robbiep-zbar-qrdecoder)[amirezaeb/heroqr

A Powerful QR Code Management Library For PHP

9813.9k](/packages/amirezaeb-heroqr)

PHPackages © 2026

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