PHP Classes

PHP QR Code Generator Page: Generate qr code images for given data

Recommend this page to a friend!
  Info   View files Example   Demos   View files View files (27)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 251 This week: 1All time: 7,909 This week: 560Up
Version License PHP version Categories
create_a_qr_code 1.0.0Custom (specified...5PHP 5, Graphics
Description 

Author

This package can generate qr code images for given data.

It provides a wrapper around Dominik Dzienia QR Code generator library to display a QR Code image in a Web page from a few parameters.

The package can take as parameters the QR code data, level and size.

Picture of Abhigyan Singh
Name: Abhigyan Singh <contact>
Classes: 1 package by
Country: India India
Age: ???
All time rank: 3982273 in India India
Week rank: 411 Up26 in India India Up

Recommendations

What is the best PHP qr code link generator class?
How to generate QR code for links to Website

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

Example

<?php
include('library/php_qr_code/qrlib.php'); // Include a library for PHP QR code

if(isset($_REQUEST['submit']) and $_REQUEST['submit']!=""){

   
//its a location where generated QR code can be stored.
   
$qr_code_file_path = dirname(__FILE__).DIRECTORY_SEPARATOR.'qr_assets'.DIRECTORY_SEPARATOR;
   
$set_qr_code_path = 'qr_assets/';

   
// If directory is not created, the create a new directory
   
if(!file_exists($qr_code_file_path)){
       
mkdir($qr_code_file_path);
    }
   
   
//Set a file name of each generated QR code
   
$filename = $qr_code_file_path.time().'.png';
   
/* All the user generated data must be sanitize before the processing */
 
if (isset($_REQUEST['level']) && $_REQUEST['level']!='')
   
$errorCorrectionLevel = $_REQUEST['level'];

 if (isset(
$_REQUEST['size']) && $_REQUEST['size']!='')
   
$matrixPointSize = $_REQUEST['size'];
   
   
$frm_link = $_REQUEST['frm_qr'];
   
   
// After getting all the data, now pass all the value to generate QR code.
   
QRcode::png($frm_link, $filename, $errorCorrectionLevel, $matrixPointSize, 2);
}
?>

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

    <div class="container">
        <div class="row justify-content-md-center">
        <div class="ml-2 col-sm-6">
            <?php if(isset($frm_link) and $frm_link!=""){?>
<div class="alert alert-success">QR created for <strong>[<?php echo $frm_link;?>]</strong></div>
            <div class="text-center"><img src="<?php echo $set_qr_code_path.basename($filename); ?>" /></div>
            <?php } ?>
<form method="post">
                <div class="form-group">
                    <label>Enter QR parameter</label>
                    <input type="text" name="frm_qr" id="frm_qr" class="form-control" placeholder="Enter QR parameter" required>
                </div>
                <div class="form-group">
                    <label>QR Code Level</label>
                    <select name="level" class="form-control">
                        <option value="L">L - smallest</option>
                        <option value="M" selected>M</option>
                        <option value="Q">Q</option>
                        <option value="H">H - best</option>
                    </select>
                </div>
                <div class="form-group">
                    <label>QR Code Size</label>
                    <select name="size" class="form-control">
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="3">3</option>
                        <option value="4" selected>4</option>
                        <option value="5">5</option>
                        <option value="6">6</option>
                        <option value="7">7</option>
                        <option value="8">8</option>
                        <option value="9">9</option>
                        <option value="10">10</option>
                    </select>
                </div>
                <div class="form-group">
                    <input type="submit" name="submit" value="Upload" class="btn btn-danger">
                </div>
            </form>
        </div>
        </div>
    </div>
   
   
   
    <!--Only these JS files are necessary-->
    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
</body>
</html>


Details

Create a QR Code in PHP

This is a simple PHP code to create QR code. Just you can download use it in your script. You can also found step to step explanation on discussdesk.com Here PHP QR Code libray is used to create this script to generate QR code.

You can see full tutorial with step by step explanation to <a href="https://www.discussdesk.com/how-to-generate-qr-code-using-php.htm">generate QR Code using php</a>.

I have also created a <a href="https://demo.discussdesk.com/generate_barcode_in_php/index.php">live demo</a> of this script to get clear idea about it.


  generate QR Code using phpExternal page  

Open in a separate window

  Files folder image Files  
File Role Description
Files folder imagelibrary (1 directory)
Files folder imageqr_assets (1 file)
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  library  
File Role Description
Files folder imagephp_qr_code (18 files, 2 directories)

  Files folder image Files  /  library  /  php_qr_code  
File Role Description
Files folder imagebindings (1 directory)
Files folder imagetools (5 files)
  Accessible without login Plain text file index.php Aux. Auxiliary script
  Accessible without login Plain text file INSTALL Example Example script
  Accessible without login Plain text file LICENSE Lic. License text
  Plain text file phpqrcode.php Class Class source
  Plain text file qrbitstream.php Class Class source
  Accessible without login Plain text file qrconfig.php Aux. Auxiliary script
  Plain text file qrconst.php Class Class source
  Plain text file qrencode.php Class Class source
  Plain text file qrimage.php Class Class source
  Plain text file qrinput.php Class Class source
  Accessible without login Plain text file qrlib.php Aux. Auxiliary script
  Plain text file qrmask.php Class Class source
  Plain text file qrrscode.php Class Class source
  Plain text file qrspec.php Class Class source
  Plain text file qrsplit.php Class Class source
  Plain text file qrtools.php Class Class source
  Accessible without login Plain text file README Doc. Documentation
  Accessible without login Plain text file VERSION Data Auxiliary data

  Files folder image Files  /  library  /  php_qr_code  /  bindings  
File Role Description
Files folder imagetcpdf (1 file)

  Files folder image Files  /  library  /  php_qr_code  /  bindings  /  tcpdf  
File Role Description
  Plain text file qrcode.php Class Class source

  Files folder image Files  /  library  /  php_qr_code  /  tools  
File Role Description
  Accessible without login Plain text file merge.bat Data Auxiliary data
  Accessible without login Plain text file merge.php Aux. Auxiliary script
  Accessible without login Plain text file merge.sh Data Auxiliary data
  Accessible without login Plain text file merged_config.php Aux. Auxiliary script
  Accessible without login Plain text file merged_header.php Aux. Auxiliary script

  Files folder image Files  /  qr_assets  
File Role Description
  Accessible without login Image file 1595748328.png Icon Icon image

 Version Control Unique User Downloads Download Rankings  
 100%
Total:251
This week:1
All time:7,909
This week:560Up