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 thepngfeature. - The
laravelfeature (on by default) addsintegration: theQrCodeConfigsection (QRCODE_*variables), theQrCodeServiceProvider,QrCodeFactoryand response helpers. Theminijinjafeature addsqrcode(..)andqrcode_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
laravelfeature. - 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()andBTC()in the PHP package, plus a vCard.
Structs§
- Color
- An RGBA color. Colors parse from
#rgb,#rrggbband#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
QrCodefacade.
Enums§
- Encoding
- How text turns into bytes before encoding, the
encodingoption of the PHP package. - Error
- Everything that can go wrong while building or rendering a QR code.
- Error
Correction - How much damage a code survives, the
errorCorrectionoption of the PHP package. - Style
- The shape of the modules, the
styleoption 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
Resultfor this crate.