CodeIgniter 4 QR-code

Install Simple-QrCode library

	
composer require simplesoftwareio/simple-qrcode
<?php
 
namespace App\Controllers;
 
use App\Controllers\BaseController;
use SimpleSoftwareIO\QrCode\Generator;
 
class Home extends BaseController
{
    public function index()
    {
        $qrcode = new Generator;
        $qrCodes = [];
        $qrCodes['simple'] = $qrcode->size(120)->generate('https://ringcome.com/');
        $qrCodes['changeColor'] = $qrcode->size(120)->color(255, 0, 0)->generate('https://ringcome.com/');
        $qrCodes['changeBgColor'] = $qrcode->size(120)->color(0, 0, 0)->backgroundColor(255, 0, 0)->generate('https://ringcome.com/');
          
        $qrCodes['styleDot'] = $qrcode->size(120)->color(0, 0, 0)->backgroundColor(255, 255, 255)->style('dot')->generate('https://ringcome.com/');
        $qrCodes['styleSquare'] = $qrcode->size(120)->color(0, 0, 0)->backgroundColor(255, 255, 255)->style('square')->generate('https://ringcome.com/');
        $qrCodes['styleRound'] = $qrcode->size(120)->color(0, 0, 0)->backgroundColor(255, 255, 255)->style('round')->generate('https://ringcome.com/');
      
        $qrCodes['withImage'] = $qrcode->size(200)->format('png')->merge('img/logo.png', .4)->generate('https://ringcome.com/');
            return view('home', $qrCodes);
    }
}
Scroll to Top