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 generator based on the implementation by Kazuhiko Arase, namespaced, cleaned up, improved and other stuff.
It also features a QR Code reader based on a PHP port of the ZXing library., (*1)

Attention: there is now also a javascript port on NPM: @chillerlan/qrcode., (*2)

PHP Version Support ![Packagist version][packagist-badge] ![Continuous Integration][gh-action-badge] ![CodeCov][coverage-badge] ![Codacy][codacy-badge] ![Packagist downloads][downloads-badge] ![Documentation][readthedocs-badge], (*3)

Overview

Features

  • Creation of Model 2 QR Codes, Version 1 to 40
  • ECC Levels L/M/Q/H supported
  • Mixed mode support (encoding modes can be combined within a QR symbol). Supported modes:
  • Flexible, easily extensible output modules, built-in support for the following output formats:
  • QR Code reader (via GD and ImageMagick)

Requirements

For the QR Code reader, either ext-gd or ext-imagick is required!, (*4)

Documentation

  • The user manual is at https://php-qrcode.readthedocs.io/ (sources)
  • An API documentation created with phpDocumentor can be found at https://chillerlan.github.io/php-qrcode/
  • The documentation for the QROptions container can be found here: chillerlan/php-settings-container

Important: Please use the examples from the branch that matches your installed php-qrcode version ( v4.x, v5.x, dev-main )!, (*5)

Installation with composer

See the installation guide for more info!, (*6)

Terminal

composer require chillerlan/php-qrcode

composer.json

{
    "require": {
        "php": "^8.2",
        "chillerlan/php-qrcode": "dev-main#<commit_hash>"
    }
}

Note: replace dev-main with a version constraint, e.g. ^5.0 - see releases for valid versions., (*7)

Quickstart

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

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

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

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

QR codes are awesome! , (*10)

Reading QR Codes

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

// it's generally a good idea to wrap the reader in a try/catch block because it WILL throw eventually
try{
    $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;
}
catch(Throwable $e){
    // oopsies!
}

Shameless advertising

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

Disclaimer!

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

License notice

Trademark Notice

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

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