Call to undefined method Endroid\QrCode\QrCode

Hi Team

I am having a problem with my qr code library because i have installed on compose correct qr-code and path. But i am getting this error “Call to undefined method Endroid\QrCode\QrCode”.

// path installed

// logic to use qr code in php

require 'C:\wamp64\www\vendor\autoload.php';

use Endroid\QrCode\QrCode;

// Process the payment and get the necessary data
$amount = $_POST['amount'];
$description = $_POST['description'];

// Generate the payment QR code
$paymentData = [
    'amount' => $amount,
    'description' => $description

$qrCode = new QrCode(json_encode($paymentData));

$qrCodeDataUri = $qrCode->writeDataUri();

// Prepare the response
$response = [
    'qr_code_url' => $qrCodeDataUri

// Send the response as JSON
header('Content-Type: application/json');
echo json_encode($response);

There is no QrCode::writeDataUri method. I took a look at the qr package and it looks like you need to use a builder to set the many dependencies. You end up with a result object that can do things like generate an inline uri. Take a look at the readme file for examples. If you are following some tutorial then you may have skipped a few steps or the tutorial is very out of date.

1 Like

@ahundiak thanks for the clarity, the documentation i had is outed makes sense.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.