PHP QR Code is open source (LGPL) library for generating QR Code, 2-dimensional barcode. Based on libqrencode C library, provides API for creating QR Code barcode images (PNG, JPEG thanks to GD2). Implemented purely in PHP, with no external dependencies (except GD2 if needed).

Some of library features includes:

  • Supports QR Code versions (size) 1-40
  • Numeric, Alphanumeric, 8-bit and Kanji encoding. (Kanji encoding was not fully tested, if you are japan-encoding enabled you can contribute by verifing it :) )
  • Implemented purely in PHP, no external dependencies except GD2
  • Exports to PNG, JPEG images, also exports as bit-table
  • TCPDF 2-D barcode API integration
  • Easy to configure
  • Data cache for calculation speed-up
  • Provided merge tool helps deploy library as a one big dependency-less file, simple to "include and do not wory"
  • Debug data dump, error logging, time benchmarking
  • API documentation
  • Detailed examples
  • 100% Open Source, LGPL Licensed


To install simply include:

  • qrlib.php for full version (also you have to provide all library files form package plus cache dir)
  • OR phpqrcode.php for merged version (only one file, but slower and less accurate code because disabled cache and quicker masking configured)

Then use it as follows:

QRcode::png('code data text', 'filename.png'); // creates file
QRcode::png('some othertext 1234'); // creates code image and outputs it directly into browser

Above examples show the most basic usage. For more features and customization see Detailed examples and PHP QR Code wiki or read INSTALL file in distrribution package.


Based on C libqrencode library (ver. 3.1.1), Copyright (C) 2006-2010 by Kentaro Fukuchi

QR Code is registered trademarks of DENSO WAVE INCORPORATED in JAPAN and other countries.

Reed-Solomon code encoder is written by Phil Karn, KA9Q. Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q


Fell free to contact me via e-mail (deltalab at poczta dot fm - prefferable) or using folowing project pages:

PHP QR Code live demo

Data:   ECC:   Size:  
Because main purpose of this demo is provide example how lib work - not to create sourceforge-based code generation service - all generated codes are padded with DEMO text, sorry