Download the PHP package isahaq/barcode without Composer

On this page you can find all versions of the php package isahaq/barcode. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package barcode

isahaq/barcode — Generate 44 barcode types and modern QR codes in PHP

isahaq/barcode

A dependency-free PHP barcode generator: 44 barcode types, multiple output formats, a CLI, and first-class Laravel integration.

Latest Version on Packagist Total Downloads Tests PHP Version

Table of Contents

Features

Requirements

Requirement Notes
PHP >= 8.0
ext-mbstring Required.
ext-gd Required for PNG and JPG output. SVG and HTML work without it.
illuminate/support 8–12 Only needed for the Laravel facade and service provider.
setasign/fpdf (or any FPDF class) Optional, only for PDF output.

Installation

On Laravel 5.5+ the service provider and facade are registered automatically via package discovery. For older versions, register them by hand in config/app.php:

Quick Start

Every method returns the encoded image as a string of bytes — write it to disk, stream it in a response, or base64-encode it into an <img> tag.

Usage

Plain PHP

Compose a type and a renderer directly when you want full control:

Colours are set on the renderer, not through the options array:

The service class

BarcodeService resolves types and renderers from strings, which is usually more convenient:

Unknown type names fall back to Code 128, and unknown formats fall back to PNG — validate input yourself if that matters to you.

QR codes

QR codes are generated through ModernQRCode, which supports logos, labels, and error correction:

Use error-correction level H whenever you overlay a logo, so the code stays scannable.

Batch generation

BatchGenerator::generate() is static and takes an instantiated type and renderer. It returns an array of encoded images keyed in the same order as the input:

Validation

Validator::validate() is static and accepts an optional by-reference error message:

Laravel

The facade proxies to BarcodeService, so every service method is available statically:

Return a barcode straight from a controller or route:

The facade also exposes a modernQr() helper that takes a single options array:

In Blade templates:

Resolve the service from the container if you prefer injection over the facade:

Command Line

The package ships a small generator script:

Omit --output to write the raw image to STDOUT. Note that this script currently always emits a Code 128 PNG — see Known Limitations.

Supported Barcode Types

Pass any of these names as the $type argument. Names are case-insensitive.

Code 128 family

code128 · code128a · code128b · code128c · code128auto

Code 39 family

code39 · code39checksum · code39e · code39echecksum · code39auto

Other linear

code93 · code25 · code25auto · code32 (Italian Pharmacode) · standard25 · standard25checksum · interleaved25 · interleaved25checksum · interleaved25auto · msi · msichecksum · msiauto

EAN / UPC

ean2 · ean5 · ean8 · ean13 · itf14 · upca · upce

Postal

postnet · planet · rms4cc · kix · imb

Specialized

codabar · code11 · pharmacode · pharmacodetwotracks

2D matrix

datamatrix · aztec · pdf417 · maxicode

Stacked linear

code16k · code49

Choosing a type

Type Example payload Best for
code128 ABC123 General purpose, high density
code39 ABC-123 Alphanumeric, inventory, legacy scanners
ean13 5901234123457 Retail products (13 digits)
ean8 96385074 Small retail products (8 digits)
upca 036000291452 North American retail
itf14 12345678901231 Shipping cartons
codabar A12345A Libraries, blood banks (needs A–D start/stop)
datamatrix Any data Tiny marking areas, pharmaceutical
pdf417 Large data ID cards, documents, boarding passes
Modern QR Any data URLs, contact details, payments

Output Formats

Format How to get it Notes
PNG png() / make(..., 'png', ...) Requires ext-gd.
SVG svg() / make(..., 'svg', ...) Scalable, no extensions needed.
HTML html() / make(..., 'html', ...) <div> markup, no extensions needed.
JPG new JPGRenderer() directly Requires ext-gd. Not resolvable by format string.
PDF new PDFRenderer() directly Requires an FPDF class to be installed.

JPG and PDF are not wired into the service's format resolver, so request them through their renderers:

Rendering Options

Options are passed as the last argument to render(), make(), png(), svg(), and html().

PNG renderer

Option Default Description
width 3 Width multiplier per module, not the total pixel width.
height 50 Barcode height in pixels.
margin 20 Space around the symbol.
text the encoded data Human-readable line; pass ' ' to hide it.
font_size 5 Built-in GD font size, 1–5.
narrow / wide 2 / 5 Narrow and wide bar widths for two-width symbologies.
quiet_zone 10 Quiet zone width for symbologies that require one.
module_size 8 Module size for 2D matrix types.

SVG renderer

Option Default Description
widthFactor 2 Width multiplier per module.
height 50 Barcode height.

Foreground and background colours are set with setForegroundColor() and setBackgroundColor() on the renderer instance, and are ignored if passed in the options array.

Known Limitations

Being upfront about the rough edges in the current release:

Contributions that close any of these gaps are very welcome.

Testing

Or run PHPUnit directly:

Other useful scripts:

Contributing

Pull requests are welcome. Please read CONTRIBUTING.md first; in short:

  1. Fork the repository and create a branch off main.
  2. Follow PSR-12 and keep the existing code style.
  3. Add tests for anything you change.
  4. Make sure composer test passes, then open a pull request.

By participating you agree to the Code of Conduct.

Security

If you discover a security issue, please review SECURITY.md and report it privately to [email protected] rather than opening a public issue.

Changelog

See CHANGELOG.md for release history.

License

Released under the MIT License.

Credits

Built and maintained by Isahaq. Thanks to everyone who has reported issues and contributed improvements.

Found this useful? Consider starring the repository.


All versions of barcode with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
ext-mbstring Version *
illuminate/support Version ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package isahaq/barcode contains the following files

Loading the files please wait ...