Download the PHP package mojahed/eduplusqr without Composer
On this page you can find all versions of the php package mojahed/eduplusqr. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mojahed/eduplusqr
More information about mojahed/eduplusqr
Files in mojahed/eduplusqr
Package eduplusqr
Short Description Fast QR code and barcode generation for PHP 7.4+ (PNG, SVG, PDF) using the standalone EduplusQR binary: 15 code types, logos, styles, Wi-Fi/vCard/payment payloads, batches, ZIP and PDF label sheets. No PHP extensions needed.
License MIT
Informations about the package eduplusqr
EduplusQR PHP SDK
Fast QR code and barcode generation for PHP 7.4+, powered by the standalone EduplusQR binary. You get PNG, SVG or PDF output, 15 code types, logos and styles, Wi-Fi, vCard and payment content, and batches with in-memory images, files, a ZIP or printable label sheets. It needs no GD, Imagick or any other PHP extension.
Using Laravel? Use
eduplus/qrinstead. It has the same API plus config, an install command and a health check.
Contents
- Installation
- Single codes
- Getting the output
- Options
- Content formats
- Batches (bulk generation)
- Errors
- Configuration
- Upgrading from 1.0.1
Installation
The package doesn't bundle the binary (that used to add about 15 MB to every project). Install it once per server:
The binary is found automatically. The package looks for the file named for your machine (EduplusQR-linux-amd64, EduplusQR-linux-arm64, EduplusQR-darwin-arm64, EduplusQR-windows-amd64.exe, …) or a plain EduplusQR, in this order:
QrCode::configure(['binary' => '/full/path'])- the
EDUPLUS_QR_BINARYenvironment variable - your project's
bin/folder, which works on shared hosting: upload the binary there. A missing execute bit is fixed automatically when PHP maychmod. /usr/local/bin,/usr/bin,/opt/eduplusandPATH
Old EduplusQR binaries (from SDK 1.0.1) are skipped automatically. Check what's used:
PHP needs proc_open(), which is enabled by default.
Single codes
Supported types (QrCode::types()): qr, code128, gs1-128, code39, code93, codabar, itf, itf14, 2of5, ean13, ean8, upca, datamatrix, pdf417, aztec.
Getting the output
| Method | Returns | Writes a file |
|---|---|---|
save($path) |
Result (path, width, height, sha256, …) |
yes (.png, .svg or .pdf; folders are created) |
toPng(), toSvg(), toPdf(), toString($format) |
raw bytes | no |
toBase64($format = null) |
base64 string | no |
toDataUri($format = null) |
data:image/png;base64,... |
no |
generateInMemory($format = null) |
Result with base64(), dataUri(), contents() |
no |
send($format = null, $downloadName = null) |
sends headers and the image to the browser | no |
validate() / isValid() |
Result / bool |
no (checks only) |
Use absolute paths with save() (for example __DIR__ . '/...').
Options
Every method returns the code, so you can chain them:
| Method | Purpose |
|---|---|
type($t) |
Code type |
ecc($level) |
QR L/M/Q/H, PDF417 0-8, Aztec 5-95 (%) |
module($px) / xdim($mm) / dpi($dpi) |
Module size in pixels, or in millimetres for print |
size($w, $h = null), width($px), height($px) |
Exact image size; the module size is fitted to it |
quiet($modules), margin($px) |
Quiet zone (0 removes it) and extra padding |
bare() |
No quiet zone, no padding, transparent background, no text |
showText(), hideText(), label($text), fontSize($px) |
Human-readable text or a custom caption |
color($fg, $bg), foreground(), background(), transparent() |
Colours (#RRGGBB, #RRGGBBAA, a name, transparent) |
rotate($deg) |
0 / 90 / 180 / 270 |
format($f) |
png, svg, pdf |
qrVersion($v), qrMinVersion($v), mask($m), eci(), exactEcc() |
QR controls (a fixed version gives every code the same size) |
style($s), logo($path, $size), logoSize($f) |
QR styling |
checksum(), fullAscii() |
Code 39 / ITF options |
verify() |
Decode the result and fail if it does not read back |
force() |
Allow low-contrast colours |
option($name, $value), options([...]) |
Any binary option by name |
Content formats
These build correctly escaped content that phones understand:
Batches (bulk generation)
A batch generates every code in one process on all CPU cores. That is much faster than calling save() in a loop. You give each row your own id, and the results come back keyed by that id, in the order you added them.
Then choose where the images go:
Mixed rows and content formats in one batch:
Working with results:
One bad row never stops a batch; it appears in failed(). Other batch settings: ->workers(4), ->skipExisting(), ->manifest(__DIR__ . '/batch.csv').
Errors
Mojahed\EduplusQR\Exceptions\BinaryNotFoundException means the binary is missing, not executable, or too old. Both extend Mojahed\EduplusQR\Exceptions\EduplusException.
Configuration
Call configure() once at startup. It's optional, because the defaults and auto-detection work without it.
QrCode and BarCode share this configuration. For two independent setups in one app, use new \Mojahed\EduplusQR\Client($binary, $config), which has the same methods (->qr(), ->barcode(), ->batch(), …).
Upgrading from 1.0.1
| 1.0.1 | 1.0.2 |
|---|---|
Binaries bundled in bin/ (QR only) |
Install the EduplusQR binary once per server (QR and barcodes) |
use Mojahed\EduplusQR; |
use Mojahed\EduplusQR\QrCode; / use Mojahed\EduplusQR\BarCode; |
EduplusQR::create()->text($t)->output($p)->generate() |
QrCode::make($t)->save($p) |
EduplusQR::quick($t, $p, 256) |
QrCode::make($t)->size(256)->save($p) |
->size(256) |
->size(256) (exact image size) or ->module(4) |
->errorCorrection('H') |
->ecc('H') |
->margin(0) |
->quiet(0); ->margin($px) is now extra padding |
generateAndReturn() / generateBase64() (wrote a file first) |
toPng() / toBase64() (no file) |
$qr->errors array, false on failure |
GenerationException with the exact message |
Copied binaries into ~/eduplus_qr_bin when chmod was disabled |
Put the binary in your project's bin/ or set EDUPLUS_QR_BINARY |
Examples and tests
License
MIT. See LICENSE.
Author
Md Mojahedul Islam: [email protected] · https://md-mojahed.github.io
Made With (❤️ Love) By: md-mojahed.github.io
All versions of eduplusqr with dependencies
ext-json Version *