How to decode qr code in php?

README

This is a PHP library to detect and decode QR-codes.
This is first and only QR code reader that works without extensions.
Ported from ZXing library

Installation

The recommended method of installing this library is via Composer.

Run the following command from your project root:

$ composer require khanamiryan/qrcode-detector-decoder

Usage

require __DIR__ . "/vendor/autoload.php";
use Zxing\QrReader;
$qrcode = new QrReader['path/to_image'];
$text = $qrcode->text[]; //return decoded text from QR Code

Requirements

  • PHP >= 8.1
  • GD Library

Contributing

You can help the project by adding features, cleaning the code, adding composer and other.

  1. Fork it
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request

  • Packages
  • Collections
  • Login

Simple PHP QR Code Reader / Decoder

PHP QR Code Reader / Decoder

This is a PHP library to detect and decode QR-codes.
This is QR code reader that works without extensions.
This library supports PSR-4.
Based on QR code decoder / reader for PHP
Ported from ZXing library

Installation

Use Composer:

composer require libern/qr-code-reader

Usage

From image url

$QRCodeReader = new Libern\QRCodeReader\QRCodeReader[];
$qrcode_text = $QRCodeReader->decode["path_to_qr_code"];
echo $qrcode_text;

From image stream

$QRCodeReader = new Libern\QRCodeReader\QRCodeReader[];
$qrcode_text = $QRCodeReader->decode[base64_encode["image_stream"]];
echo $qrcode_text;

Requirements

  • PHP >= 5.6
  • GD Library

Author

libern

In this article i will show how to process QR codes in PHP and how to generate QR code images and scan those images back to their original text.

Overview

QR codes is a standard that represents some decoded text often used with commercial items such as products and it used to identify those items in graphical format in the form of images. There are a lot of software that can generate and scan QR codes and in this tutorial we will show you how to manipulate QR codes with PHP.

For the purpose of this tutorial we will use two libraries that can be used to generate and scan QR codes, which are:

  • phpqrcode: we will use this to generate QR codes, you can download it from this link.
  • php-qrcode-detector-decoder: we will use to scan QR codes install it from this link.

After downloading the two libraries add them to your project, in the next sections we will see how to generate QR codes.

Generating QR codes:

To generate QR codes you need first to include the qrlib.php in your project, next create a new file generate.php as shown below:

Bài mới nhất

Chủ Đề