PHPackages                             athulr/laravel-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. athulr/laravel-qr

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

athulr/laravel-qr
=================

QR code generator for Laravel

1.0.0(5mo ago)02MITPHP

Since Dec 5Pushed 5mo agoCompare

[ Source](https://github.com/athulrajdr/laravel-qr)[ Packagist](https://packagist.org/packages/athulr/laravel-qr)[ RSS](/packages/athulr-laravel-qr/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Laravel QR Code Generator
=========================

[](#laravel-qr-code-generator)

A simple and flexible QR code generator for Laravel applications, based on `BaconQrCode`. This package allows you to generate QR codes with custom colors, sizes, styles, and embedded logos.

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

[](#installation)

This package is currently configured as a local package. Ensure your main `composer.json` includes the repository path:

```
"repositories": [
    {
        "type": "path",
        "url": "./packages/athulr/laravel-qr"
    }
],
```

Then require the package:

```
composer require athulr/laravel-qr
```

Basic Usage
-----------

[](#basic-usage)

To generate a simple QR code, use the `QrCode` facade:

```
use Athulr\LaravelQr\Facades\QrCode;

// Returns an SVG string by default
return QrCode::generate('Hello World');
```

Configuration
-------------

[](#configuration)

You can chain methods to configure the QR code:

```
QrCode::size(500)
      ->margin(2)
      ->color('#00FF00') // Hex string
      ->backgroundColor(255, 255, 255) // RGB integers
      ->generate('Hello World');
```

### Available Methods

[](#available-methods)

- **`size(int $pixels)`**: Set the size of the QR code in pixels (default: 200).
- **`margin(int $margin)`**: Set the white space margin around the QR code (default: 0).
- **`format(string $format)`**: Set the output format to `'svg'` (default), `'png'`, `'jpg'`, or `'webp'`.
- **`response(string $text)`**: Generates the QR code and returns a Laravel `Response` object with the correct `Content-Type` header.
- **`color($r, $g = null, $b = null)`**: Set the foreground color. Accepts a hex string (e.g., `'#FF0000'`) or RGB integers.
- **`backgroundColor($r, $g = null, $b = null)`**: Set the background color. Accepts a hex string or RGB integers.
- **`errorCorrection(string $level)`**: Set the error correction level: `'L'` (Low), `'M'` (Medium), `'Q'` (Quartile), `'H'` (High).

Advanced Styling
----------------

[](#advanced-styling)

You can customize the shape of the modules (dots) and the eyes (finder patterns).

```
QrCode::style('dot')
      ->eye('circle')
      ->generate('Styled QR Code');
```

- **`style(string $style, float $intensity = null)`**: Set the module style.
    - `'square'` (default)
    - `'dot'`
    - `'round'`
- **`eye(string $style)`**: Set the style for both the eye frame and ball.
    - `'square'` (default)
    - `'circle'`

### Independent Eye Customization

[](#independent-eye-customization)

You can customize the outer frame and the inner ball of the eyes independently:

```
QrCode::eyeFrame('circle') // Circular outer frame
      ->eyeBall('square')  // Square inner ball
      ->generate('Custom Eye Styles');
```

- **`eyeFrame(string $style)`**: Set the style of the outer eye frame.
- **`eyeBall(string $style)`**: Set the style of the inner eye ball.

Logo Embedding
--------------

[](#logo-embedding)

You can embed a logo in the center of the QR code. **Note:** This requires the `format` to be set to `'png'` and the `imagick` PHP extension to be installed.

```
QrCode::format('png')
      ->logo(public_path('logo.png'), 30) // Path and size percentage (default 20%)
      ->generate('QR with Logo');
```

- **`logo(string $path, int $percentage = 20)`**: Embeds an image at the given path. The `percentage` argument determines how much of the QR code width the logo should occupy.
- *Note: Using `logo` requires a raster format (`png`, `jpg`, `webp`) and the `imagick` extension. It automatically sets error correction to `'H'`.*

Saving to File
--------------

[](#saving-to-file)

You can save the generated QR code directly to a file:

```
QrCode::save('Hello World', storage_path('app/qr-code.svg'));
```

Base64 Data URI
---------------

[](#base64-data-uri)

Get the QR code as a Base64 data URI (useful for embedding in `` tags):

```
$dataUri = QrCode::base64('Hello World');
// Output: data:image/svg+xml;base64,...
```

HTTP Response
-------------

[](#http-response)

You can return the QR code directly as an HTTP response with the correct `Content-Type` header. This is useful for displaying the image directly in a browser or `` tag source.

```
Route::get('/qr-code', function () {
    return QrCode::size(500)
        ->format('webp')
        ->response('Hello World');
});
```

Image Quality &amp; Sharpness
-----------------------------

[](#image-quality--sharpness)

For raster formats (`png`, `jpg`, `webp`), the package uses improved rendering with **anti-aliasing** and **supersampling** to ensure smooth edges on circular eyes and dot modules.

**Important:** To ensure sharpness, always generate the QR code at the size you intend to display it. For example, if you want to display a 1000px image, call `size(1000)`. Upscaling a small generated image (e.g., 200px displayed at 1000px) will result in blurriness.

```
// Good: Generates a high-res, smooth image
QrCode::size(1000)->format('png')->generate('...');
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance72

Regular maintenance activity

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

158d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/983afc320e353fa5e16e788f5e865adc6483113dd86e939973fc68fa31633908?d=identicon)[athulrajdr](/maintainers/athulrajdr)

---

Top Contributors

[![athulraj-kodelarks](https://avatars.githubusercontent.com/u/189051212?v=4)](https://github.com/athulraj-kodelarks "athulraj-kodelarks (4 commits)")

### Embed Badge

![Health badge](/badges/athulr-laravel-qr/health.svg)

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

###  Alternatives

[endroid/qr-code

Endroid QR Code

4.8k67.6M348](/packages/endroid-qr-code)[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

22.8k69.3k](/packages/grumpydictator-firefly-iii)[simplesoftwareio/simple-qrcode

Simple QrCode is a QR code generator made for Laravel.

2.9k27.6M92](/packages/simplesoftwareio-simple-qrcode)[greenter/greenter

Facturacion Electrónica SUNAT en Perú

31530.2k1](/packages/greenter-greenter)[revolution/self-ordering

Self Ordering System

2112.7k](/packages/revolution-self-ordering)[linkxtr/laravel-qrcode

A clean, modern, and easy-to-use QR code generator for Laravel

295.1k](/packages/linkxtr-laravel-qrcode)

PHPackages © 2026

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