Download the PHP package atelier/barcode without Composer
On this page you can find all versions of the php package atelier/barcode. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download atelier/barcode
More information about atelier/barcode
Files in atelier/barcode
Package barcode
Short Description PHP library that builds QR codes, matrix codes, and barcodes as SVG, PNG, or GIF
License MIT
Homepage https://github.com/ateliersvg/barcode
Informations about the package barcode
QR codes, matrix codes, and barcodes as SVG, in pure PHP.
Fifteen symbologies, from QR Code and Data Matrix to EAN, UPC, ISBN, GS1, Code 39, Code 93,
Code 128, ITF and Codabar. Each one is a fluent builder whose render() returns a string of
SVG markup.
No required extensions, no image library, no runtime dependencies. The output drops into an
<img>, a background-image, an inline <svg>, a PDF, or an email. Every symbology is verified
module by module by an extensive test suite.
PNG and GIF · Documentation
Installation
Requires PHP 8.3 or later. ext-gd is needed only for PNG output.
Quick start
A linear barcode is the same shape of call:
Every builder is created with ::create(), configured by chaining, and finished with
render(). See Getting started.
Every symbology
| Symbology | Preview | Kind | Input |
|---|---|---|---|
| QR Code | 2D matrix | numeric, alphanumeric, or byte data | |
| Data Matrix | 2D matrix | extended ASCII, up to 44 chars | |
| GS1 DataMatrix | 2D matrix | GS1 AI pairs, single-region | |
| EAN-13 | 1D linear | 12-13 digits | |
| EAN-8 | 1D linear | 7-8 digits | |
| UPC-A | 1D linear | 11-12 digits | |
| UPC-E | 1D linear | 6-8 digits, number system 0 or 1 | |
| ISBN | 1D linear | ISBN-10 or ISBN-13 | |
| Code 128 | 1D linear | 7-bit ASCII | |
| Code 39 | 1D linear | A-Z 0-9 space - . $ / + % |
|
| Code 93 | 1D linear | A-Z 0-9 space - . $ / + % |
|
| GS1-128 | 1D linear | GS1 AI pairs | |
| ITF-14 | 1D linear | 13-14 digits | |
| Interleaved 2 of 5 | 1D linear | even-length digits | |
| Codabar | 1D linear | digits, - $ : / . +, guards A-D |
Each page carries that symbology's options, defaults, bounds, and the exceptions it throws.
Styling and size
Every builder shares margin(), foreground(), background(), and a size call: size() for
matrix codes, scale() and height() for linear ones.
Symbology-specific settings sit alongside them: error correction for QR, a Mod 43 checksum for Code 39, bearer bars for ITF-14, explicit guards for Codabar. See Options.
PNG and GIF
SVG is the default output. When a bitmap is what the consumer needs, a raster renderer takes the same geometry the builder already computed.
PngRenderer requires ext-gd. GifRenderer has the same signature and needs nothing at all,
assembling the file byte by byte in PHP. See Renderers.
Raw geometry
A builder can return its geometry instead of markup, for composing into a larger document or
rendering with something else entirely. QrCode and DataMatrix expose matrix(), linear
symbologies expose modules().
Error handling
Every exception implements Atelier\Barcode\Exception\CodeExceptionInterface, so one catch
covers the package.
The concrete types are InvalidCodeException, InvalidColorException, and
MissingExtensionException.
Documentation
- Installation: requirements, and verifying the install.
- Getting started: the first symbol, and what to do when it throws.
- Every symbology: compare the fifteen and pick one.
- Options: every setting, its default, and its bounds.
- Renderers: SVG, PNG, and GIF.
The full documentation is published at ateliersvg.com/barcode.
Contributing
Contributions are welcome. Visit the project on GitHub to report a bug, suggest a feature, or open a pull request.
Before submitting code, run:
Changes to public behaviour need a test and a documentation update.
Support
Bug reports, security disclosures, and contribution guidelines are collected at ateliersvg.com/support.
Sharing the package or starring it on GitHub helps more than you would think.
License
Atelier Barcode is released under the MIT License.