2017 © Pedro Peláez
 

library php-qrcode

A QR code generator. PHP 7+

image

chillerlan/php-qrcode

A QR code generator. PHP 7+

  • Thursday, June 21, 2018
  • by codemasher
  • Repository
  • 11 Watchers
  • 154 Stars
  • 59,895 Installations
  • PHP
  • 5 Dependents
  • 3 Suggesters
  • 15 Forks
  • 0 Open issues
  • 25 Versions
  • 44 % Grown

The README.md

chillerlan/php-qrcode

A PHP QR Code library based on the implementation by Kazuhiko Arase, namespaced, cleaned up, improved and other stuff. It also features a QR Code reader which is based on the ZXing library., (*1)

Attention: there is now also a javascript port: chillerlan/js-qrcode., (*2)

PHP Version Support ![Packagist version][packagist-badge] License ![Continuous Integration][gh-action-badge] ![CodeCov][coverage-badge] ![Scrunitizer CI][scrutinizer-badge] ![Packagist downloads][downloads-badge], (*3)

Features

  • Generation of Model 2 QR Codes, Version 1 to 40
  • ECC Levels L/M/Q/H supported
  • Mixed mode support (encoding modes can be mixed as needed within a QR symbol)
    • Supported modes: numeric, alphanumeric, 8-bit binary as well as the 13-bit double-byte modes kanji (Japanese, Shift-JIS) and hanzi (simplified Chinese, GB2312/GB18030)
  • Flexible, easily extensible output modules
    • Built-in support for the following output formats:
    • GdImage
    • ImageMagick
    • Markup types: SVG, HTML, etc.
    • String types: JSON, plain text, etc.
    • Encapsulated Postscript (EPS)
    • PDF via FPDF
  • QR Code reader (via GD and ImageMagick)

Documentation

See the wiki for advanced documentation. An API documentation created with phpDocumentor can be found at https://chillerlan.github.io/php-qrcode/ (WIP)., (*4)

Requirements

For the QRCode reader, either ext-gd or ext-imagick is required!, (*5)

Installation

requires composer, (*6)

via terminal:, (*7)

composer require chillerlan/php-qrcode

via composer.json:, (*8)

{
    "require": {
        "php": "^7.4 || ^8.0",
        "chillerlan/php-qrcode": "dev-main"
    }
}

Note: replace dev-main with a version constraint, e.g. ^4.3 - see releases for valid versions. See the installation guide on the wiki for more info!, (*9)

Quickstart

We want to encode this URI for a mobile authenticator into a QRcode image:, (*10)

$data = 'otpauth://totp/test?secret=B3JX4VCVJDVNXNZ5&issuer=chillerlan.net';

// quick and simple:
echo '<img src="'.(new QRCode)->render($data).'" alt="QR Code" />';

QR codes are awesome! , (*11)

Wait, what was that? Please again, slower! See Advanced usage on the wiki. Also, have a look in the examples folder for some more usage examples., (*12)

Reading QR Codes

Using the built-in QR Code reader is pretty straight-forward:, (*13)

$result = (new QRCode)->readFromFile('path/to/file.png'); // -> DecoderResult

// you can now use the result instance...
$content = $result->data;
$matrix  = $result->getMatrix(); // -> QRMatrix

// ...or simply cast it to string to get the content:
$content = (string)$result;

It's generally a good idea to wrap the reading in a try/catch block to handle any errors that may occur in the process., (*14)

Framework Integration

Shameless advertising

Hi, please check out my other projects that are way cooler than qrcodes!, (*15)

Disclaimer!

I don't take responsibility for molten CPUs, misled applications, failed log-ins etc.. Use at your own risk!, (*16)

License notice

Parts of this code are ported to php from the ZXing project and licensed under the Apache License, Version 2.0., (*17)

Trademark Notice

The word "QR Code" is a registered trademark of DENSO WAVE INCORPORATED
https://www.qrcode.com/en/faq.html#patentH2Title, (*18)

The Versions

21/06 2018

dev-master

9999999-dev https://github.com/chillerlan/php-qrcode

A QR code generator. PHP 7+

  Sources   Download

MIT

The Requires

 

The Development Requires

qr code

28/03 2018

2.0.6

2.0.6.0 https://github.com/chillerlan/php-qrcode

A QR code generator. PHP 7+

  Sources   Download

MIT

The Requires

 

The Development Requires

qr code

21/03 2018

2.0.5

2.0.5.0 https://github.com/chillerlan/php-qrcode

A QR code generator. PHP 7+

  Sources   Download

MIT

The Requires

 

The Development Requires

qr code

10/03 2018

2.0.4

2.0.4.0 https://github.com/chillerlan/php-qrcode

A QR code generator. PHP 7+

  Sources   Download

MIT

The Requires

 

The Development Requires

qr code

23/01 2018

2.0.3

2.0.3.0 https://github.com/chillerlan/php-qrcode

A QR code generator. PHP 7+

  Sources   Download

MIT

The Requires

 

The Development Requires

qr code

23/01 2018

dev-v2.0.x-php5

dev-v2.0.x-php5 https://github.com/chillerlan/php-qrcode

A QR code generator. PHP 7+

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

qr code

21/01 2018

2.0.2

2.0.2.0 https://github.com/codemasher/php-qrcode

A QR code generator. PHP 7+

  Sources   Download

MIT

The Requires

 

The Development Requires

qr code

19/01 2018

1.0.8

1.0.8.0 https://github.com/codemasher/php-qrcode

A QR code generator. PHP 7+

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

qr code

29/12 2017

2.0.1

2.0.1.0 https://github.com/codemasher/php-qrcode

A QR code generator. PHP 7+

  Sources   Download

MIT

The Requires

 

The Development Requires

qr code

24/12 2017

2.0.0

2.0.0.0 https://github.com/codemasher/php-qrcode

A QR code generator. PHP 7+

  Sources   Download

MIT

The Requires

 

The Development Requires

qr code

10/11 2017

v1.2.x-dev

1.2.9999999.9999999-dev https://github.com/codemasher/php-qrcode

A QR code generator. PHP 7+

  Sources   Download

MIT

The Requires

  • php >=7.0.3

 

The Development Requires

qr code

10/11 2017

1.2.2

1.2.2.0 https://github.com/codemasher/php-qrcode

A QR code generator. PHP 7+

  Sources   Download

MIT

The Requires

  • php >=7.0.3

 

The Development Requires

qr code

25/10 2017

1.2.1

1.2.1.0 https://github.com/codemasher/php-qrcode

A QR code generator. PHP 7+

  Sources   Download

MIT

The Requires

  • php >=7.0.3

 

The Development Requires

qr code

25/10 2017

1.2.0

1.2.0.0 https://github.com/codemasher/php-qrcode

A QR code generator. PHP 7+

  Sources   Download

MIT

The Requires

  • php >=7.0.3

 

The Development Requires

qr code

27/02 2017

1.1.1

1.1.1.0 https://github.com/codemasher/php-qrcode

A QR code generator. PHP 7+

  Sources   Download

MIT

The Requires

  • php >=7.0.3

 

The Development Requires

qr code

10/02 2017

1.1.0

1.1.0.0 https://github.com/codemasher/php-qrcode

A QR code generator. PHP 5.6+, PHP 7

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

qr code

10/02 2017

dev-php5

dev-php5 https://github.com/codemasher/php-qrcode

A QR code generator. PHP 5.6+, PHP 7

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

qr code

10/02 2017

1.0.7

1.0.7.0 https://github.com/codemasher/php-qrcode

A QR code generator. PHP 5.6+, PHP 7

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

qr code

18/12 2016

1.0.6

1.0.6.0 https://github.com/codemasher/php-qrcode

A QR code generator. PHP 5.6+, PHP 7

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

qr code

17/03 2016

1.0.5

1.0.5.0 https://github.com/codemasher/php-qrcode

A QR code generator. PHP 5.6+, PHP 7

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

qr code

29/02 2016

1.0.4

1.0.4.0 https://github.com/codemasher/php-qrcode

A QR code generator. PHP 5.6+, PHP 7

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

qr code

24/02 2016

1.0.3

1.0.3.0 https://github.com/codemasher/php-qrcode

A QR code generator. PHP 5.6+, PHP 7

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

qr code

09/02 2016

1.0.2

1.0.2.0 https://github.com/codemasher/php-qrcode

A QR code generator. PHP 5.6+, PHP 7

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

qr code

05/01 2016

1.0.1

1.0.1.0 https://github.com/codemasher/php-qrcode

A QR code generator. PHP 5.6+, PHP 7

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

qr code

11/12 2015

1.0.0

1.0.0.0 https://github.com/codemasher/php-qrcode

A QR code generator. PHP 5.6+, PHP 7

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

qr code