Quick start
Every entry point on the Qr facade returns a PendingQr builder. It is Htmlable, Responsable and Stringable, so the same object renders in Blade, becomes an HTTP response, or produces an Svg value object:
use RoundlyConsulting\Qr\Facades\Qr;
// Blade: {{ }} renders the SVG unescaped (PendingQr and Svg are Htmlable)
{{ Qr::url('https://example.com/pets/Ab3x') }}
$svg = Qr::text('Table 12 — scan to order')->size(240)->margin(2)->svg(); // Svg value object
$markup = $svg->toString();
$uri = Qr::text('hello')->toDataUri(); // data:image/svg+xml;charset=utf-8,…
// Controllers: return the builder; it becomes an image/svg+xml response
Route::get('/tables/{table}/qr', fn (Table $table) => Qr::url(route('menu', $table)));Returned from a controller, the builder becomes an image/svg+xml response with caching headers chosen by the payload’s sensitivity — see Responses and Sensitivity & caching. Prefer constructor injection? Type-hint QrFactory — see DI without the facade.
Show your open-source love
This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.
More ways to support, including cryptoBy donating, you agree to our donation terms.
Want this built into your product?
We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.