PHP Classes

PHP QR Code Generator: Generate QR Code images in pure PHP

Recommend this page to a friend!
  Info   View files Example   Demos   Screenshots Screenshots   View files View files (21)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 66%Total: 1,176 All time: 3,218 This week: 39Up
Version License PHP version Categories
phpqr 1.0.24BSD License5.0PHP 5, Graphics


This package can generate QR Code images in pure PHP.

The main class can take a given string of data and generates the matrix of QR Code points. The type of QR code and error correction level are configurable parameters.

A separate class can render the generated QR Code and render it as a JPEG image of a given width and height. The generated image is return as a string of JPEG image data.

This package is inspired on Jerome Etienne jQuery plugin.

Picture of Maik Greubel
  Performance   Level  
Name: Maik Greubel <contact>
Classes: 10 packages by
Country: Germany Germany
Age: ???
All time rank: 106267 in Germany Germany
Week rank: 161 Up5 in Germany Germany Up
Innovation award
Innovation award
Nominee: 4x


What is the best PHP qr code generation class?
I need php code to generate qr code offline


 * This file is part of the phpQr package
 * See @see QRCode class for description of package and license.
ini_set('display_errors', 1);

get_include_path() .


$code = new QRCode(-1, QRErrorCorrectLevel::H);
$img = new QRCodeImage($code, 256, 256, 10);
catch (
Exception $ex)
$ex->getMessage() . "\n";
$ex->getTraceAsString() . "\n";


phpQr - A QRCode encoder class

by Maik Greubel (

The intention to create a basic qrcode encoder for PHP was a request on

The author studied multiple sources to get an idea how qrcode implementation works under the hood. The best source was the JavaScript library jquery which provides a HTML Table based implementation. See source and documentation at <>

So the hard work was already done by Jerome Etienne. My part was only to port it to PHP code.

Currently this package does not have the capability to read QRCodes.

Further readings

For a detailed description of QRCode and its features please check <>

Trademark information

QR Code is registered trademark of DENSO WAVE INCORPORATED <>


All files in the package are published under the terms of the BSD 2 License. <>

  DemoExternal page  
  • tests/test.jpg
  • tests/unicode-test.jpg
  Files folder image Files  
File Role Description
Files folder imagesrc (12 files)
Files folder imagetests (2 files)
Accessible without login Plain text file Doc. Readme
Accessible without login Plain text file composer.json Data composer artifact to retrieve dependencies
Accessible without login Plain text file ErrorHandler.php Aux. A simple error handler which translates notices, warnings and errors into exceptions
Accessible without login Plain text file phpdoc.dist.xml Data phpDocumentor configuration
Accessible without login Plain text file qrcode-display.php Example demo for displaying image in browser
Accessible without login Plain text file qrcode-form.php Example example script which provides a form
Accessible without login Plain text file SimpleLogger.php Aux. My simple logger class

  Files folder image Files  /  src  
File Role Description
  Plain text file QR8bitByte.php Class This class provides the 8bit Byte implementaton of a QRByte
  Plain text file QRBitBuffer.php Class The purpose of this class is to act as data holder for QRCode
  Plain text file QRByte.php Class This interface describes a QRByte implementation
  Plain text file QRCode.php Class This is the main class
  Plain text file QRCodeException.php Class A derived exception
  Plain text file QRCodeImage.php Class This class provides all needed functionality to create an image out of an QRCode bitmap
  Plain text file QRErrorCorrectLevel.php Class Error correct level enumeration
  Plain text file QRMath.php Class QRCode math helper class
  Plain text file QRMode.php Class QRCode mode enumeration
  Plain text file QRPolynominal.php Class The purpose of this class is to provide a polynominal implementation for the QRCode package
  Plain text file QRRSBlock.php Class This class is a Reed-Solomon implementation for the QRCode.
  Plain text file QRUtil.php Class QRCode common utility functions

  Files folder image Files  /  tests  
File Role Description
  Accessible without login Plain text file qrcode-test.php Example A sample script
  Accessible without login Plain text file unicode-test.php Example A test for unicode data

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:3,218
This week:39Up
 User Ratings  
 All time