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 74%Total: 1,158 This week: 2All time: 3,272 This week: 96Up
Version License PHP version Categories
phpqr 1.0.24BSD License5.0PHP 5, Graphics
Description 

Author

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: 107168 in Germany Germany
Week rank: 106 Up5 in Germany Germany Up
Innovation award
Innovation award
Nominee: 4x

Recommendations

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

Example

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

set_include_path(
 
get_include_path() .
 
PATH_SEPARATOR .
 
'../src'
);

require_once
'QRErrorCorrectLevel.php';
require_once
'QRCode.php';
require_once
'QRCodeImage.php';

try
{
 
$code = new QRCode(-1, QRErrorCorrectLevel::H);
 
$code->addData("http://www.phpclasses.org");
 
$code->make();
 
 
$img = new QRCodeImage($code, 256, 256, 10);
 
$img->draw();
 
$img->store("test.jpg");
 
$img->finish();
}
catch (
Exception $ex)
{
  echo
$ex->getMessage() . "\n";
  echo
$ex->getTraceAsString() . "\n";
}


Details

phpQr - A QRCode encoder class

by Maik Greubel (greubel@nkey.de)

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

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 <https://github.com/jeromeetienne/jquery-qrcode>

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 <http://www.qrcode.com/>

Trademark information

QR Code is registered trademark of DENSO WAVE INCORPORATED <http://www.denso-wave.com/qrcode/faqpatent-e.html>

License

All files in the package are published under the terms of the BSD 2 License. <http://opensource.org/licenses/BSD-2-Clause>


  DemoExternal page  
Screenshots  
  • 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 README.md 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  
 0%
Total:1,158
This week:2
All time:3,272
This week:96Up
 User Ratings  
 
 All time
Utility:100%StarStarStarStarStarStar
Consistency:91%StarStarStarStarStar
Documentation:75%StarStarStarStar
Examples:83%StarStarStarStarStar
Tests:-
Videos:-
Overall:74%StarStarStarStar
Rank:82