Generate QR Code In PHP using libqrencode C library

PHP

Hello everyone, in this tutorial i am going to explain how to generate QR code in PHP using PHP QR code library.

QR code means Quick Response Code, and it is a 2D bar code images of texts.

Generating QR code in PHP  using libqrencode C library,which is an opensource library, type provide API for generating bar codes and are purely implemented in PHP.

Follow below steps to generate QR Code in PHP,

Step 1 : Download QRcode library from  http://phpqrcode.sourceforge.net/

Step 2 : Create a PHP file and name it as generateQRCode.php, then copy and paste below code.

1
2
3
4
5
6
7
8
9
10
11
12
13
<?php

include(‘qrlib.php’);  // include the library for generating QR code

$text             = ‘hardycodes’; // generating the qr code of the given text

$file_name = “qrcodes/qrcode.png”; //mention the path to save qr code image

QRcode::png($text,$file_name); // generating the qr code

echo”<img src=’qrcodes/qrcode.png’>”;

?>

Step 3: Yup !. now run the code, you can see the generated QR Code of  the text given by you.

Leave a Reply

Your email address will not be published. Required fields are marked *