PHP code example of vladpak1 / too-simple-qr

1. Go to this page and download the library: Download vladpak1/too-simple-qr 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/ */

    

vladpak1 / too-simple-qr example snippets



use vladpak1\TooSimpleQR\QRFactory;
use vladpak1\TooSimpleQR\OutputConstants;
use vladpak1\TooSimpleQR\Image\Logo;

// Load composer
ogo->setByPath(Logo::TWITTER_LOGO);

$settings
    ->setOutput(OutputConstants::OUTPUT_PNG)
    ->setSize(500)                              // Size in pixels.
    ->setBackgroundColor('#ffffff')             // Background color in HEX format.
    ->setMargin(50)                             // Margin in pixels.
    ->setFinderColor('#1d9bf0')                 // Finder color in HEX format.
    ->setDataColor('#3284bc')                   // Data color in HEX format.
    ->setCorrectionLevel(OutputConstants::CORRECTION_LEVEL_H) // Correction level.
    ->setCircularModules(true)                  // Round modules.
    ->setCircleRadius(0.75)                     // Circle radius.
    ->setLogo($logo)                            // Logo.
    ->setCustomFinderShape(OutputConstants::SHAPE_CIRCLE); // Custom finder shape.

$qrCodeImage = $qr
    ->setData('Hello World!')
    ->setSettings($settings)
    ->render();
    
// Now we can save or directly output (as HTML) the QR code.
$qrCodeImage->echo();


->setBackgroundGradient('#FFD8D8', '#FFF9F9', Gradient::DIRECTION_BOTTOM_TO_TOP);


$preset = new \vladpak1\TooSimpleQR\Preset\Presets\InstagramPreset('Hello World!');

// You can also set the driver and output interface for the preset.
$preset
    ->setDriver(\vladpak1\TooSimpleQR\OutputConstants::DRIVER_GD)
    ->setOutput(\vladpak1\TooSimpleQR\OutputConstants::OUTPUT_PNG);
    
// We get a branded Instagram QR code.
$preset->render()->save('path/to/qr.png');



$qr->setDriver(OutputConstants::DRIVER_GD);