Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,29 @@ php artisan laranail::pdf.install
php artisan laranail::pdf.doctor
```

## Quick start
## Quick start guide and usage

### Getting started

1. The default driver is `gotenberg`. To render in-process with Dompdf instead, set it in `.env`:

```env
LARANAIL_PDF_DRIVER=dompdf
```

2. For Gotenberg, run an instance and point the package at it:

```bash
docker run --rm -p 3000:3000 gotenberg/gotenberg:8
```

```env
LARANAIL_PDF_GOTENBERG_URL=http://localhost:3000
```

3. Prove each available driver actually renders: `php artisan laranail::pdf.doctor --probe`.

### Usage

```php
use Simtabi\Laranail\Pdf\Facades\Pdf;
Expand All @@ -40,6 +62,12 @@ return Pdf::view('invoices.show', ['invoice' => $invoice]);
Pdf::merge($statementPaths)->store("statements/{$year}.pdf", 's3');
```

Force a download, with a name:

```php
return Pdf::view('invoices.show', compact('invoice'))->download("invoice-{$invoice->id}.pdf");
```

## The two decisions worth knowing

**A driver cannot claim a capability it has not implemented.** `supports()` is derived from `instanceof`
Expand Down
Loading