PHP code example of acelaya / zf2-acqrcode

1. Go to this page and download the library: Download acelaya/zf2-acqrcode 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/ */

    

acelaya / zf2-acqrcode example snippets


'modules' => array(
    'Application',
    'ZfcUser',
    'ZfcBase',
    'Acelaya\QrCode' // <-- This line will do the job
)

<img src=" echo $this->url('acelaya-qrcode', ['message' => 'This is a QR code example']) 

 echo $this->qrCode()->renderImg('The message', 'png', 300, 20); 

 echo $this->qrCode()->renderImg('The message', 'png', ['title' => 'This is a cool QR code', 'class' => 'img-thumbnail']); 

 echo $this->qrCode()->renderBase64Img('http://www.alejandrocelaya.com/skills', 'gif', 350, 5, ['title' => 'This is a cool QR code', 'class' => 'img-thumbnail']) 

<div>
    <h2>This is a nice title</h2>
    <div style="background: url( echo $this->qrCode('The message', 'png') 

<div>
    <h2>This is a nice title</h2>
    <div style="background: url( echo $this->qrCode()->setRouteOptions(['force_canonical' => true])->assembleRoute('The message', 'png') 

/** @var \Zend\ServiceManager\ServiceLocatorInterface $sm */
$service = $sm->get('Acelaya\QrCode\Service\QrCodeService');
$content = $service->getQrCodeContent('http://www.alejandrocelaya.com/contact', 'png');

// Save the image to disk
file_put_contents('/path/to/file.png', $content);

// In a controller...

/** @var \Zend\ServiceManager\ServiceLocatorInterface $sm */
$service = $sm->get('Acelaya\QrCode\Service\QrCodeService');
$content = $service->getQrCodeContent($this->params());

// Save the image to disk
file_put_contents('/path/to/file.png', $content);