Article Content:How to generate QR code with codeigniter

How to generate QR code with codeigniter

How to generate QR code with codeigniter .

Many days ago and I came back again with new task and new tutorial, this tutorial about

 Qr code... So before see the video lets know what QRcode is and how to use it?


What is a QR code?

A QR code is a shortcut of Quick Response code it is a type of barcode, it is the updated version of the barcode, and it is a (2D) barcode that can store about 4,000 alphanumeric characters in a just small image.

It was developed to serve auto manufacturing industry but today it has a number of purposes in many cases like  (marketing, transportation, entertainment .etc.)

Why was it most popular?

Because it was very easy to use, just go to iPhone store or play store or any mobile application store, download Qr reader application and scan with your mobile camera.

You don’t need to use barcode scanner, it is also can take actions not just copy data from QR code, as example you can redirect someone to your Facebook page or your YouTube channel or to send SMS or to make Skype call, Whatsapp use QR code to encrypt users data and to complete authentication login process.

NotePHP QR Code is Open Source (LGPL) library for generating QR Code if you want to read the full documentation for more details you can read it from here





1- Download the project from the bottom link page and extract it in localhost

2- Create new database, name it as (demo)

3- Import tables from application/tables

4- Go to the URL  http://localhost/codeigniter_demo/Qr_code_generate



Project structure:

In this app we have


1- Qr_code_generate controller

In this controller, we have two methods Index to show random user from users table and print_qr to generate Qr image files from users table

2- User_model model

To select our users from users table

3- Ci_qr_code library

Import qr_code original files from third party folder

4- QR code third_party

The original files for PHP QR code library, you can also download this package from their Sourceforge repo in this link, but I recommended to use it from my full example directly

5- Global folder

Contains assets file like bootstrap 3 main framework and starter theme with JavaScript , HTML ,  CSS  files

6- Views folder

Which contains views file for our layout templates with header and footer and content


                          TRY Demo   Download

You can show this video to show how it is works

  • Martin
    Your example does not work, even the online demo. Error message: ob_clean(): failed to delete buffer. No buffer to delete File: /home/webeasys/public_html/demo/codeigniter_demo/application/controllers/Qr_code_generate.php Line: 88 Function: ob_clean
    August 2, 2017
    • admin
      thanks martin for your feedback , i will fix it ASAP
      August 2, 2017
  • Gilang
    Help I got error how to fix it? Severity: Warning Message: imagepng(C:\xampp\htdocs\PROJECT\FixedAsset/Assets/tmp/qr_codes/PC-000002 .png): failed to open stream: Invalid argument Filename: qrcode/qrimage.php Line Number: 46 Backtrace:
    August 8, 2017

Leave a Reply

Your email address will not be published.

Notify me of followup comments via e-mail.
You can also Subscribe without commenting.