PHP code example of safermobility / laravel-gotenberg

1. Go to this page and download the library: Download safermobility/laravel-gotenberg library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

safermobility / laravel-gotenberg example snippets


return [
    'host' => env('GOTENBERG_HOST'),
];

use SaferMobility\LaravelGotenberg\Facades\Gotenberg;

Gotenberg::view('pdfs.invoice', ['invoice' => $invoice])
    ->format('letter')
    ->save('invoice.pdf')

use SaferMobility\LaravelGotenberg\Facades\Gotenberg;

class DownloadInvoiceController
{
    public function __invoke(Invoice $invoice)
    {
        return Gotenberg::view('pdfs.invoice', ['invoice' => $invoice])
            ->format('letter')
            ->name('your-invoice.pdf');
    }
}
bash
php artisan vendor:publish --tag="laravel-gotenberg-config"