Skip to main content

How to generate Qrcode Using Codeigniter

Today Tutorial about is how to generate qrcode using Codeigniter. So firstly we know about what is the QR Code.

What is Qr Code ?

QR stands for quick response it’s another form of bar code but some significant difference between them while barcodes hold information only in the horizontal direction, QR codes stores information in both direction horizontally as well as vertically. In QR code we can store information like web url, email, phone number etc.
Information of Qr code is decoded using dedicated QR code scanner or Qr code decoding apps.
So let’s starts the coding parts


We use PHPQRCODE library for generating the QR code.So you can download the library using this link PHP QR CODE Library Download


Next We Create the view file for enter the text and generate the QR code from this text

Some brief description of the Qrcontroller.php file

We can Load the Php QR Code library in the constructor of the controller

Next we get the entered text and generate the QR Code

  • $qrtext – Inputted text that can be encoded in QR Code
  • $SERVERFILEPATH – Path of server where QR Images to be stored
  • $file_name1 – Name of QR images file
  • QRcode::png($text,$file_name) – Using QRcode::png() function we generate QR code it takes two parameter first one is entered text and 2nd is the name of the QR image file.

Controller ( QrController.php )

I hope this tutorial helpful for you,Please share this post in social media


Recomended Tutorial

2 thoughts to “How to generate Qrcode Using Codeigniter”

  1. HI,

    Thanks for the tutorial , but its doesn’t work in HMVC environment , error comes like

    A PHP Error was encountered
    Severity: Error

    Message: Class ‘Qrlib’ not found

    Filename: MX/Loader.php

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.