PHPackages                             hennest/qr-code - 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. [Image &amp; Media](/categories/media)
4. /
5. hennest/qr-code

ActiveLibrary[Image &amp; Media](/categories/media)

hennest/qr-code
===============

qr-code generator for laravel apps.

1.1(1y ago)032MITPHPPHP ^8.2

Since Jul 28Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Hennest/qr-code)[ Packagist](https://packagist.org/packages/hennest/qr-code)[ RSS](/packages/hennest-qr-code/feed)WikiDiscussions main Synced yesterday

READMEChangelog (3)Dependencies (5)Versions (4)Used By (0)

Qr Code Generator
=================

[](#qr-code-generator)

This library provides a simple and easy-to-use QR code generator for PHP applications. It is built on top of the [BaconQrCode](https://github.com/Bacon/BaconQrCode) library and offers a flexible and efficient way to generate QR codes.

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

[](#installation)

You can install this library via Composer:

```
composer require hennest/qr-code
```

Laravel Integration
-------------------

[](#laravel-integration)

This library comes with a Laravel service provider for easy integration. After installation, add the service provider to your `config/app.php` file:

```
'providers' => [
    // Other Service Providers
    Hennest\QRCode\Providers\QRCodeServiceProvider::class,
],
```

### Configuration

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag=qr-code
```

This will create a `config/qr-code.php` file where you can customize the library settings.

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
use Hennest\QRCode\Enums\Color;
use Hennest\QRCode\Configuration\Dimension;
use Hennest\QRCode\Configuration\ColorScheme;
use Hennest\QRCode\Services\QRCodeInterface;

class ExampleController
{
    public function __construct(
        private QRCodeInterface $qrCode
    ) {}

    public function example()
    {
        // Generate a QR code
        $qrCode = $this->qrCode->generate('https://example.com')->toSvg();

        // Generate a QR code with custom settings
        $qrCode = $this->qrCode->generate(
            content: 'https://example.com',
            dimension: new Dimension(
                size: 300,
                margin: 300
            ),
            colorScheme: new ColorScheme(
                foreground: Color::Black,
                background: Color::White
            )
        )->toSvg();

        // Save a QR code to a file
        $this->qrCode->generate('https://example.com')->toImage('path/to/file.svg');
    }

    public function anotherExample()
    {
        // Generate a QR code
        $qrCode = app(QRCodeInterface::class)->generate('https://example.com')->toSvg();

        // Generate a QR code with custom settings
        $qrCode = app(QRCodeInterface::class)->generate(
            content: 'https://example.com',
            dimension: new Dimension(
                size: 300,
                margin: 300
            ),
            colorScheme: new ColorScheme(
                foreground: Color::Black,
                background: Color::White
            )
        )->toSvg();

        // Save a QR code to a file
        $qrCode = app(QRCodeInterface::class)->generate('https://example.com')->toImage('path/to/file.svg');
    }
}
```

### Configuration Options

[](#configuration-options)

The `config/qr-code.php` file allows you to customize various aspects of the library. Here's a breakdown of the available options:

```
return [
    /**
     * QR Code assembler configuration
     */
    'assembler' => [
        /**
         * QR Code assembler
         */
        'assembler' => Hennest\QRCode\Assembler\QRCodeAssembler::class,
        /**
         * QR Code assembler disk
         */
        'disk' => 'public',
    ],
    /**
     * QR Code default encoding
     */
    'encoding' => BaconQrCode\Encoder\Encoder::DEFAULT_BYTE_MODE_ECODING,
    /**
     * QR Code service
     */
    'qr-code' => Hennest\QRCode\Services\QRCode::class,
    /**
     * QR Code renderer configuration
     */
    'renderer' => [
        /**
         * QR Code renderer
         */
        'renderer' => BaconQrCode\Renderer\ImageRenderer::class,
        /**
         * QR Code renderer backend
         */
        'backend' => BaconQrCode\Renderer\Image\SvgImageBackEnd::class,
        /**
         * QR Code renderer default style configuration
         */
        'style' => [
            /**
             * QR Code renderer style
             */
            'style' => Hennest\QRCode\Configuration\RenderStyle::class,
            /**
             * QR Code renderer size
             */
            'size' => env('QR_CODE_SIZE', 300),
            /**
             * QR Code renderer margin
             */
            'margin' => env('QR_CODE_MARGIN', 4),
            /**
             * QR Code renderer color
             */
            'color' => [
                /**
                 * QR Code renderer foreground color
                 */
                'foreground' => Hennest\QRCode\Enums\Color::Black,
                /**
                 * QR Code renderer background color
                 */
                'background' => Hennest\QRCode\Enums\Color::White,
            ],
        ],
    ],
];
```

#### Key Configuration Options:

[](#key-configuration-options)

- `assembler.disk`: Set the default disk for saving QR codes.
- `renderer.style.size`: Set the default size for QR codes.
- `renderer.style.margin`: Set the default margin for QR codes.
- `renderer.style.color.foreground`: Set the default foreground color for QR codes.
- `renderer.style.color.background`: Set the default background color for QR codes.

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

License
-------

[](#license)

This library is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

3

Last Release

701d ago

Major Versions

0.0.1 → 1.02024-07-28

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/46072450?v=4)[Uwadiegwu Ernest Chinonso](/maintainers/hennest)[@Hennest](https://github.com/Hennest)

---

Top Contributors

[![Hennest](https://avatars.githubusercontent.com/u/46072450?v=4)](https://github.com/Hennest "Hennest (5 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/hennest-qr-code/health.svg)

```
[![Health](https://phpackages.com/badges/hennest-qr-code/health.svg)](https://phpackages.com/packages/hennest-qr-code)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[statamic/cms

The Statamic CMS Core Package

4.8k3.6M985](/packages/statamic-cms)[danog/madelineproto

Async PHP client API for the telegram MTProto protocol.

3.5k902.0k23](/packages/danog-madelineproto)[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

23.9k69.5k](/packages/grumpydictator-firefly-iii)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[jason-munro/cypht

Lightweight Open Source webmail written in PHP and JavaScript

1.6k157.9k](/packages/jason-munro-cypht)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
