# laravel-rust-qrcode

> Rust port of simplesoftwareio/simple-qrcode: QR codes for routes, templates, and files.

- Package: laravel-rust-qrcode (Laravel for Rust, alpha), crates: `laravel-rust-qrcode`, `laravel-rust-qrcode-core`
- Maintenance: active; Latest release: 0.1.0 (2026-12-04); Framework: laravel-rust 0.2.x; MSRV: Rust 1.99 or later; Licence: MIT
- Links: [Repository](https://github.com/bowerbird-si/laravel-rust-qrcode), [crates.io](https://crates.io/crates/laravel-rust-qrcode/0.1.0), [docs.rs](https://docs.rs/laravel-rust-qrcode/0.1.0), [Changelog](https://oss.bowerbird.si/qrcode/docs/changelog/), [Contributing](https://github.com/bowerbird-si/laravel-rust-qrcode/blob/0d4061426c0e70f1d1e0fac79c65fe7f046a3dab/CONTRIBUTING.md), [Security policy](https://github.com/bowerbird-si/laravel-rust-qrcode/blob/0d4061426c0e70f1d1e0fac79c65fe7f046a3dab/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.
- PHP parity: core (13 covered, 19 diverged, 18 planned of 50 abilities; 83 fixtures; follows simplesoftwareio/simple-qrcode 4.2.0; verified 2026-12-04)
- Community package, not affiliated with Laravel.
- HTML version: https://oss.bowerbird.si/qrcode/
- Documentation: https://oss.bowerbird.si/qrcode/docs.md

Serve a QR image from a Laravel route, put it in a MiniJinja view, or render it with the standalone Rust core. The encoder and renderers are checked against fixtures produced by Simple QrCode 4.2.0.

```shell
cargo add laravel-rust-qrcode@0.1.0
```

- **SVG, PNG, and EPS.** Set the size, quiet zone, and colors for any of the three formats. PNG works without Imagick. Gradients, module styles, finder options, and logo merges are planned.
- **Laravel routes and views.** Use `Generator::response` in a route or register the service provider for inline SVG and PNG data URIs in MiniJinja.
- **Payload helpers.** Build QR payloads for email, geographic coordinates, phone calls, SMS, Wi-Fi, and Bitcoin.

### Generate a PNG

Encode a URL and leave a four-module quiet zone for scanning.

```rust
use laravel_rust_qrcode::{Format, Generator};

fn main() -> Result<(), laravel_rust_qrcode::Error> {
    let code = Generator::new()
        .format(Format::Png)
        .size(174)
        .margin(4)
        .generate("https://example.test/")?;
    println!("{} ({} bytes)", code.content_type(), code.as_bytes().len());
    Ok(())
}
```
