PHP code example of webpatser / qr-code

1. Go to this page and download the library: Download webpatser/qr-code library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

webpatser / qr-code example snippets


use QR_Code\QR_Code;

// Generate a simple QR code as PNG
$result = QR_Code::png('Hello World!', 'qrcode.png');

// Generate SVG
QR_Code::svg('Hello World!', 'qrcode.svg');

// Get as base64 data URL (no file)
$dataUrl = QR_Code::png('Hello World!');
echo $dataUrl; // data:image/png;base64,...