Skip to main content

Crate laravel_qrcode

Crate laravel_qrcode 

Source
Expand description

QR codes for Laravel Rust, the counterpart of the PHP package simplesoftwareio/simple-qrcode.

The crate has two layers:

  • The core (QrCode, payload, Error) does not depend on any framework and compiles with --no-default-features. It renders SVG, and PNG with the png feature.
  • The laravel feature (on by default) adds integration: the QrCodeConfig section (QRCODE_* variables), the QrCodeServiceProvider, QrCodeFactory and response helpers. The minijinja feature adds qrcode(..) and qrcode_uri(..) to the framework’s views.
use laravel_qrcode::{QrCode, payload};

let svg = QrCode::new().size(200).svg(payload::wifi("Office", "s3cret")).unwrap();
assert!(svg.starts_with("<?xml"));

Encoding is done by the qrcode crate. This crate only draws the modules, so there is no image-processing dependency tree.

Re-exports§

pub use integration::QrCodeConfig;
pub use integration::QrCodeFactory;
pub use integration::QrCodeServiceProvider;

Modules§

integration
The Laravel Rust integration, behind the laravel feature.
payload
Data-type helpers: the strings that phones turn into actions when a code is scanned. They are the counterparts of QrCode::email(), phoneNumber(), SMS(), geo(), wiFi() and BTC() in the PHP package, plus a vCard.

Structs§

Color
An RGBA color. Colors parse from #rgb, #rrggbb and #rrggbbaa.
Matrix
The encoded modules of a QR code, before any rendering.
QrCode
The fluent QR code builder, the counterpart of the PHP package’s QrCode facade.

Enums§

Encoding
How text turns into bytes before encoding, the encoding option of the PHP package.
Error
Everything that can go wrong while building or rendering a QR code.
ErrorCorrection
How much damage a code survives, the errorCorrection option of the PHP package.
Style
The shape of the modules, the style option of the PHP package.

Constants§

MAX_LOGO_RATIO
The largest share of the code’s width a logo may cover. Larger logos make codes unreadable.

Type Aliases§

Result
A specialised Result for this crate.