DEV Community

Cover image for Generate QR Code using php
Abhigyan Singh
Abhigyan Singh

Posted on

Generate QR Code using php

These days, the term QR code is gaining more popularity due to its common use in daily routine life. It is commonly used on online shopping and digital payment. A QR code (Quick Response code) is a two-dimensional barcode that is first designed in 1994 for use in the automotive industry in Japan.

It is a machine-readable label that contains some amount of information about the product or item. This QR code can be easily scanned by any scanner device and able to read the stored information.

In this article, I will show you to easily generate QR code in PHP. I have used PHP as a language to generate QR code because it is a widely used language online. Now I will be the PHP QR Code library to generate QR code.

There are several QR code generators is available online but there are some situations where we need to integrate custom code in our application. So this tutorial will get more insight about to generate QR code using PHP.

Here I will create a file in PHP called index.php

<?php
include('library/php_qr_code/qrlib.php');
$frm_link ="";
$filename="";
$errorCorrectionLevel="";
$matrixPointSize="";
$framePointSize="";

QRcode::png($frm_link, $filename, $errorCorrectionLevel, $matrixPointSize, $framePointSize);

?>

These are the argument passed in above function QRcode::png()

$frm_link : A input parameter for which we need to generate QR code.

$filename: It is just a path or location to store generated QR code. This also defines the name of each QR code.

$errorCorrectionLevel : It shows the capability.

$matrixPointSize : It defines the pixel size of QR code.

$framePointSize: The size of QR code.

These generated QR codes can also be stored in the database by its generated name for further use in our application.

Top comments (1)

Collapse
 
stackfindover profile image
Stackfindover

Hii...
This is awesome post, thanks for sharing this awesome type of content :)
Generate QR Code using JavaScript