# laravel-go-qrcode

> Go port of simplesoftwareio/simple-qrcode: Styled QR codes for Go and Laravel for Go.

- Package: laravel-go-qrcode (Laravel for Go, alpha), go modules: `github.com/bowerbird-si/laravel-go-qrcode`
- Maintenance: active; Latest release: 0.1.0 (2026-12-04); Framework: go.laravel.com v0.2.0 or later; Go: Go 1.27 or later; Licence: MIT
- Links: [Repository](https://github.com/bowerbird-si/laravel-go-qrcode), [pkg.go.dev](https://pkg.go.dev/github.com/bowerbird-si/laravel-go-qrcode@v0.1.0), [Changelog](https://oss.bowerbird.si/go-qrcode/docs/changelog/), [Contributing](https://github.com/bowerbird-si/laravel-go-qrcode/blob/ba3241b489aeb301f0dcce65f5cea9e55f79dc24/CONTRIBUTING.md), [Security policy](https://github.com/bowerbird-si/laravel-go-qrcode/blob/ba3241b489aeb301f0dcce65f5cea9e55f79dc24/SECURITY.md)
- Based on: [Simple QrCode](https://github.com/SimpleSoftwareIO/simple-qrcode): The QR code builder this package ports: formats, styling, logos, payload helpers and Laravel integration, following version 4.2.0.; [go-qr](https://github.com/krobertson/go-qr): QR encoding.; [gozxing](https://github.com/makiuchi-d/gozxing): Scans the generated codes in the tests.
- PHP parity: full (23 covered, 27 diverged, 0 planned of 50 abilities; 74 fixtures; follows simplesoftwareio/simple-qrcode 4.2.0; verified 2026-12-04)
- Community package, not affiliated with Laravel.
- HTML version: https://oss.bowerbird.si/go-qrcode/
- Documentation: https://oss.bowerbird.si/go-qrcode/docs.md

Render QR codes as SVG, PNG or EPS. Set module and eye shapes, colors and gradients, and add logos to PNG output.

```shell
go get github.com/bowerbird-si/laravel-go-qrcode@v0.1.0
```

- **PHP conformance fixtures.** Tests compare behavior with fixtures from `simplesoftwareio/simple-qrcode` 4.2.0. The parity matrix records tested abilities and deliberate differences.
- **Typed payload helpers.** Build payloads for WiFi networks, email, SMS, geographic coordinates, phone numbers and Bitcoin payments. Each helper validates its input.
- **Laravel for Go adapter.** Register `laravelqr` to use a shared generator, view helpers and image responses with the matching content type.

### Render SVG and PNG

Reuse the generator to render the same text as SVG or a PNG data URI.

```go
g, err := qrcode.New(qrcode.Size(200), qrcode.Margin(4))
if err != nil {
	log.Fatal(err)
}

svg, err := g.SVG("https://example.com")
if err != nil {
	log.Fatal(err)
}

src, err := g.DataURI("https://example.com", qrcode.PNGFormat)
if err != nil {
	log.Fatal(err)
}
```

### Show a QR code in a Laravel view

Register the adapter to inline SVG with `qrcode` or get a PNG data URI with `qrcodeSrc`.

```html
{{ qrcode .TicketURL }}
<img src="{{ qrcodeSrc .TicketURL }}" alt="Ticket QR code">
```
