PHPackages                             yoha/qr - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. yoha/qr

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

yoha/qr
=======

This package is made to make qr generation easy

v1.2.0(1y ago)45291MITPHPPHP ^8.3.0CI passing

Since Feb 9Pushed 1y ago1 watchersCompare

[ Source](https://github.com/yohaqr/yohaqr)[ Packagist](https://packagist.org/packages/yoha/qr)[ RSS](/packages/yoha-qr/feed)WikiDiscussions master Synced today

READMEChangelog (6)Dependencies (7)Versions (8)Used By (0)

YohaQR
======

[](#yohaqr)

*By [yohaqr](https://github.com/yohaqr)*

If you appreciate my work, please consider supporting me by visiting the [sponsor page](https://github.com/sponsors/yohacodes) or [buying me a coffee](https://www.buymeacoffee.com/yohacodes) ☕.

[![Latest Stable Version](https://camo.githubusercontent.com/180dd69e2d9d9a8f07825482fb52e3160a6a08546be2d43e97f6c42dae244c2c/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f796f68612f71722e737667)](https://packagist.org/packages/yoha/qr)[![Build Status](https://github.com/yohaqr/yohaqr/actions/workflows/php.yml/badge.svg)](https://github.com/yohaqr/yohaqr/actions/workflows/php.yml)[![Total Downloads](https://camo.githubusercontent.com/1fda558e5441083a0ade8548b8bf71060ab5de927803dfcf9111eedcf9473e03/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f796f68612f71722e737667)](https://packagist.org/packages/yoha/qr)[![Monthly Downloads](https://camo.githubusercontent.com/bdeeb175f215eda4bcffaf6c0a258e9fc80650cf9aea47acc8351a95719331cf/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f796f68612f71722e737667)](https://packagist.org/packages/yoha/qr)[![License](https://camo.githubusercontent.com/4e4986713f36e86649894399a7bfa472542ec30639b194dec8307215e02260ef/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f796f68612f71722e737667)](https://packagist.org/packages/yoha/qr)

[![YohaQR](https://avatars.githubusercontent.com/u/198384864?s=200&v=4)](https://avatars.githubusercontent.com/u/198384864?s=200&v=4)

Overview
--------

[](#overview)

YohaQR is a powerful PHP Composer package that offers a simple, fluent API for generating dynamic QR codes using the latest [Endroid QR Code](https://github.com/endroid/qr-code) library. With YohaQR you can easily customize your QR codes by:

- **Custom Data Encoding:** Embed any text, URL, or custom data.
- **Adjustable Size and Margin:** Control the overall dimensions and the surrounding margin.
- **Error Correction &amp; Encoding:** Select suitable error correction levels and encoding options.
- **Logo Integration:** Seamlessly add a custom logo with options for resizing and background removal.
- **Labeling:** Optionally append a label with custom fonts and alignment.

Warning
-------

[](#warning)

> **"Install GD or Imagepk extension for PHP."**

We'll install either the **GD** or **ImageMagick (imagick)** extension based on your system.

---

🖥️ 1. **On Linux (Ubuntu/Debian)**
----------------------------------

[](#️-1-on-linux-ubuntudebian)

### ✅ **Install GD Extension**

[](#-install-gd-extension)

```
sudo apt update
sudo apt install php-gd -y
sudo systemctl restart apache2  # or php-fpm, if you're using it
```

### ✅ **(Alternative) Install ImageMagick**

[](#-alternative-install-imagemagick)

```
sudo apt install php-imagick -y
sudo systemctl restart apache2
```

---

🖥️ 2. **On Fedora / CentOS / RHEL**
-----------------------------------

[](#️-2-on-fedora--centos--rhel)

### ✅ **Install GD Extension**

[](#-install-gd-extension-1)

```
sudo dnf install php-gd -y
sudo systemctl restart httpd
```

### ✅ **(Alternative) Install ImageMagick**

[](#-alternative-install-imagemagick-1)

```
sudo dnf install php-pecl-imagick -y
sudo systemctl restart httpd
```

---

🖥️ 3. **On Windows (XAMPP/WAMP)**
---------------------------------

[](#️-3-on-windows-xamppwamp)

### ✅ **Enable GD Extension in php.ini**

[](#-enable-gd-extension-in-phpini)

1. Open the file: `php.ini`

    - In XAMPP: located at `C:\xampp\php\php.ini`
    - In WAMP: `C:\wamp64\bin\php\php.ini`
2. Find and **uncomment** the line:

    ```
    ;extension=gd
    ```

    Change it to:

    ```
    extension=gd
    ```
3. Restart Apache via the XAMPP/WAMP control panel.

---

✅ 4. **Verify Installation**
----------------------------

[](#-4-verify-installation)

### Using terminal/command:

[](#using-terminalcommand)

```
php -m | grep -E "gd|imagick"
```

### Or create a file `phpinfo.php`:

[](#or-create-a-file-phpinfophp)

```

```

Installation
------------

[](#installation)

Install YohaQR via Composer:

```
composer require yoha/qr
```

> **Note:** YohaQR requires PHP ^8.1. Ensure you have the latest version of PHP and Composer installed.

Supported Output Types
----------------------

[](#supported-output-types)

YohaQR supports multiple output formats for your QR codes:

1. **PNG** (Default)
2. **PDF**
3. **WEBP**
4. **SVG**
5. *More formats coming soon...*

You can change the output format using the `setWriterType()` method.

Changing the Writer Type
------------------------

[](#changing-the-writer-type)

By default, YohaQR generates PNG images. To change the writer type (e.g., to PDF, WEBP, or SVG), call the `setWriterType()` method with the desired format:

```
