Saving and Storing
Saving to a Local Path
$path = RaastQr::make()
->amount($order->total)
->save(storage_path('app/qr/order-' . $order->id . '.svg'));Missing directories are created for you. The method returns the path it wrote to.
Format Inference
Both save() and store() read the file extension and switch format accordingly:
RaastQr::make()->save('/tmp/code.svg'); // renders SVG
RaastQr::make()->save('/tmp/code.png'); // renders PNGAn extension the package doesn't recognise leaves the current format alone, so you stay in control:
RaastQr::make()->format('svg')->save('/tmp/code.txt'); // still SVGStoring on a Filesystem Disk
$path = RaastQr::make()
->amount($order->total)
->store('qr/order-' . $order->id . '.png', 'public');Any configured disk works — local, public, s3, whatever you've set up. Omit the disk to use the default.
// Then hand out a URL
Storage::disk('public')->url($path);Should You Store Them at All?
Usually, no.
A QR code is cheap to regenerate — a payload string and a bit of drawing. Storing one means keeping a file that encodes a customer's account and order total, then remembering to clean it up.
Generate on the fly and serve it from a route instead:
Route::get('/orders/{order}/qr', fn (Order $order) =>
RaastQr::make()->amount($order->total)->format('svg')
)->middleware('auth');See HTTP Responses.
When Storing Does Make Sense
- Attaching to a PDF invoice that's archived anyway
- Print runs where a designer needs the file
- Static counter codes that never change and get printed repeatedly
For those, prefer SVG and put the file somewhere private:
RaastQr::iban($iban)
->format('svg')
->size(1200)
->store('print/counter-card.svg', 'local');Don't put payment QRs on a public disk by accident
A code on the public disk is a URL anyone can guess or share. It won't let them take money from you — a Raast QR only ever sends money to the account — but it does leak the account number and, if the amount is baked in, an order total.
Made with ❤️ from Pakistan