Skip to content

Latest commit

 

History

History
56 lines (44 loc) · 1.28 KB

README.md

File metadata and controls

56 lines (44 loc) · 1.28 KB

QrCode Plugin docs

Helper usage

Add the helper in your AppView class:

$this->loadHelper('QrCode.QrCode');

Then you can use it in your views to display QR codes:

echo $this->QrCode->image($text, $optionalOptions);

By default, it uses base64encoded images, so no 2nd request is required.

Formatter

You can use the built-in formatter for most common QR code types:

  • Text
  • Url
  • Phone Number (Call)
  • Text message (SMS)
  • eMail
  • Geo Coordinates (Maps)
  • Wifi Network
  • Market
  • Vcard
$text = $this->Qrcode->formatter()->formatText($text);
$geo = $this->Qrcode->formatter()->formatGeo($lat, $lng);
$sms = $this->Qrcode->formatter()->formatSms($number, $text);
...

echo $this->QrCode->image(...);

It will help to normalize user input coming from forms or alike.

Controller rendering

If you want more control over the image, as well as type (png, svg), you can also let the controller action render it and use it as a generated on-the-fly image.

echo $this->QrCode->svg($content, $options);
// or
echo $this->QrCode->png($content, $options);

Advanced usage

See also https://php-qrcode.readthedocs.io/en/v5.0.x/Usage/Advanced-usage.html

Admin Backend

Go to /admin/qr-code.

Make sure you set up ACL to only have admins access this part.