PHP code example of honzito / bacon-qr-code-basis

1. Go to this page and download the library: Download honzito/bacon-qr-code-basis 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/ */

    

honzito / bacon-qr-code-basis example snippets



use BaconQrCode\Renderer\GDLibRenderer;
use BaconQrCode\Writer;

$renderer = new GDLibRenderer(300);
$writer   = new Writer($renderer);
$qr_image = base64_encode($writer->writeString("Hola, hola"));
echo "<img src='data:image/png;base64,$qr_image' alt='QR Code'>";

//$writer->writeFile('Hello World!', 'qrcode.png');