nguyenary/qr-code-monkey

PHP Library for free generator QR Code from qrcode-monkey.com

v1.0 2021-09-01 14:50 UTC

This package is auto-updated.

Last update: 2024-04-17 08:30:07 UTC


README

👉 A library using PHP to generate QRCode from https://www.qrcode-monkey.com free
NOTE: Do not generate too many QRCode at once or your IP will be locked for a period of time

facebook.svg youtube.svg ninja.svg twitter.svg rain.svg jungle.svg

Getting started

Use composer to integrate your PHP project

composer require nguyenary/qr-code-monkey

Configuration

📘 You can configure to generate QRCode or use default configuration. Below is a list of configurations that you can use

Parameter Type Default Description
body String square square.png     square
mosaic.png     mosaic
dot.png     dot
circle.png     circle
circle-zebra.png     circle-zebra
circle-zebra-vertical.png     circle-zebra-vertical
circular.png     circular
edge-cut.png   edge-cut
edge-cut-smooth.png   edge-cut-smooth
japnese.png   japnese
leaf.png   leaf
pointed.png   pointed
pointed-edge-cut.png   pointed-edge-cut
pointed-in.png   pointed-in
pointed-in-smooth.png   pointed-in-smooth
pointed-smooth.png   pointed-smooth
round.png   round
rounded-in.png   rounded-in
rounded-in-smooth.png   rounded-in-smooth
rounded-pointed.png   rounded-pointed
star.png   star
diamond.png   diamond
eye String frame0 frame0.png   frame0
frame1.png   frame1
frame2.png   frame2
frame3.png   frame3
frame4.png   frame4
frame5.png   frame5
frame6.png   frame6
frame7.png   frame7
frame8.png   frame8
frame10.png   frame10
frame11.png   frame11
frame12.png   frame12
frame13.png   frame13
frame14.png   frame14
frame16.png   frame16
eyeBall String ball0 ball0.png   ball0
ball1.png   ball1
ball2.png   ball2
ball3.png   ball3
ball5.png   ball5
ball6.png   ball6
ball7.png   ball7
ball8.png   ball8
ball10.png   ball10
ball11.png   ball11
ball12.png   ball12
ball13.png   ball13
ball14.png   ball14
ball15.png   ball15
ball16.png   ball16
ball17.png   ball17
ball18.png   ball18
ball19.png ball19
erf1 Array [ ] Rotate the upper left eye element. Add "fv" or "fh" to invert element vertically or horizontally. E.g. ["fv","fh"] inverts a element vertically and horziontally.
erf2 Array [ ] Rotate the upper right eye element. Add "fv" or "fh" to invert element vertically or horizontally. E.g. ["fv","fh"] inverts a element vertically and horziontally.
erf3 Array [ ] Rotate the lower left eye element. Add "fv" or "fh" to invert element vertically or horizontally. E.g. ["fv","fh"] inverts a element vertically and horziontally.
brf1 Array [ ] Rotate the upper left eye ball element. Add "fv" or "fh" to invert element vertically or horizontally. E.g. ["fv","fh"] inverts a element vertically and horziontally.
brf2 Array [ ] Rotate the upper right eye ball element. Add "fv" or "fh" to invert element vertically or horizontally. E.g. ["fv","fh"] inverts a element vertically and horziontally.
brf3 Array [ ] Rotate the lower left eye ball element. Add "fv" or "fh" to invert element vertically or horizontally. E.g. ["fv","fh"] inverts a element vertically and horziontally.
bodyColor String #000000 Color of QR code body as HEX value.
bgColor String #ffffff Color of QR code background as HEX value. Note: the background should always have a lighter color to be scanable with all devices.
eye1Color String #000000 Color of the upper left eye as HEX value.
eye2Color String #000000 Color of the upper right eye as HEX value.
eye3Color String #000000 Color of the lower left eye as HEX value.
eyeBall1Color String #000000 Color of the upper left eye ball as HEX value.
eyeBall2Color String #000000 Color of the upper right eye ball as HEX value.
eyeBall3Color String #000000 Color of the lower left eye ball as HEX value.
gradientColor1 String null Color 1 for gradient color of body as HEX.
gradientColor2 String null Color 2 for gradient color of body as HEX.
gradientType String linear Gradient type for color of body. Value can be "linear" or "radial".
gradientOnEyes Boolean false Disable individual colors for the eye elements and set the gradient color for the complete QR code.

Example Usage

For details on the examples please see the file example.php

First you need to initialize a QRCode instance

require_once 'vendor/autoload.php';

use nguyenary\QRCodeMonkey\QRCode;

$qrcode = new QRCode('nguyenary');

Example easy usage:

print_r($qrcode->create());

The above code will return a URL containing a QR Code

Example of saving QRCode as a file

$qrcode->create('file_qrcode.png');

Example for config:

$qrcode = new QRCode('nguyenary');

$qrcode->setConfig([
    'bgColor' => '#FFFFFF',
    'body' => 'square',
    'bodyColor' => '#0277bd',
    'brf1' => [],
    'brf2' => [],
    'brf3' => [],
    'erf1' => [],
    'erf2' => [],
    'erf3' => [],
    'eye' => 'frame0',
    'eye1Color' => '#000000',
    'eye2Color' => '#000000',
    'eye3Color' => '#000000',
    'eyeBall' => 'ball0',
    'eyeBall1Color' => '#000000',
    'eyeBall2Color' => '#000000',
    'eyeBall3Color' => '#000000',
    'gradientColor1' => '#0277bd',
    'gradientColor2' => '#000000',
    'gradientOnEyes' => 'true',
    'gradientType' => 'linear',
]);

Example for set logo, file type and size

// Set logo path file to use
$qrcode->setLogo('image/facebook.png');

// Support png, svg, jpg, pdf, eps
$qrcode->setFileType('png');

// Size limit is 3480 pixel
$qrcode->setSize(200);

Features

What's all the bells and whistles this project can perform?

  • High quality images for printing
  • Generate QRCode completely for free
  • Many QRCode templates can be customized
  • Can be exported as a URL or saved as a file
  • Output format options (Support png, svg, jpg, pdf, eps)

NOTE: Format pdf and eps no support for color gradients

Contributing

This is a project I do in my spare time to contribute to the community. I would very much welcome if you would like to contribute to this project

Licensing

The code in this project is licensed under MIT license