New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

haska/laravel-snappy

Laravel snappy package
32 1

Larablocks Analysis

haska/laravel-snappy has no release yet to check Laravel compatibility against.

Recommendation checks

Use with care

Use with care: meets 0 of 3 checks.

  • No dated releases
  • 0 downloads a month (needs 10,000)
  • 1 GitHub star (needs 100)

Data from Packagist and GitHub, checked by Larablocks on Nov 26, 2026.

Install
composer require haska/laravel-snappy:dev-master
PHP:>=5.3.0
Last Updated:May 25, 2014
Links: GitHub  ·  Packagist
Maintainer: haska

Laravel snappy package

Informations

Provider:

'Haska\Snappy\SnappyServiceProvider',

Alias:

'PDF' => 'Haska\Snappy\Facades\SnappyPdf',
'Image' => 'Haska\Snappy\Facades\SnappyImage',

Config:

php artisan config:publish haska/laravel-snappy

Usage

You can create a new Snappy PDF/Image instance and load a HTML string, file or view name. You can save it to a file, or stream (show in browser) or download.

Using the App container:

$snappy = App::make('snappy.pdf');
//To file
$snappy->generateFromHtml('<h1>Bill</h1><p>You owe me money, dude.</p>', '/tmp/bill-123.pdf');
$snappy->generate('http://www.github.com', '/tmp/github.pdf'));
//Or output:
return new Response(
    $snappy->getOutputFromHtml($html),
    200,
    array(
        'Content-Type'          => 'application/pdf',
        'Content-Disposition'   => 'attachment; filename="file.pdf"'
    )
);

Using the wrapper:

$pdf = App::make('snappy.pdf.wrapper');
$pdf->loadHTML('<h1>Test</h1>');
return $pdf->stream();

Or use the facade:

$pdf = PDF::loadView('pdf.invoice', $data);
return $pdf->download('invoice.pdf');

You can chain the methods:

return PDF::loadFile('http://www.github.com')->stream('github.pdf');

You can change the orientation and paper size

PDF::loadHTML($html)->setPaper('a4')->setOrientation('landscape')->setOption('margin-bottom', 0)->save('myfile.pdf')

If you need the output as a string, you can get the rendered PDF with the output() function, so you can save/output it yourself.

Alternatives to haska/laravel-snappy

spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

48,654,677 5,251
nitmedia/wkhtml2pdf

Html 2 Pdf - using wkhtml2pdf, work on 32bit and 64 bit linux + MacOS

316,234 116
wemersonjanuario/pdf

HTML to PDF Converter based on wkhtmltopdf

20,188 5
justsmiletoo/laravel-file-compressor

Automatically compress images, PDFs and videos on upload in Laravel. Auto-detect...

1,522 0