Download the PHP package fruitcake/laravel-weasyprint without Composer
On this page you can find all versions of the php package fruitcake/laravel-weasyprint. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fruitcake/laravel-weasyprint
More information about fruitcake/laravel-weasyprint
Files in fruitcake/laravel-weasyprint
Informations about the package laravel-weasyprint
WeasyPrint PDF Wrapper for Laravel
This package is a ServiceProvider for WeasyPrint: https://github.com/pontedilana/php-weasyprint.
This package is based heavily on https://github.com/barryvdh/laravel-snappy but uses WeasyPrint instead of WKHTMLTOPDF
WeasyPrint Installation
Follow the setup here: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#installation
Testing the WeasyPrint installation
After installing, you should be able to run WeasyPrint from the command line / shell.
Package Installation
Require this package in your composer.json and update composer.
Configuration
You can publish the config file:
Usage
You can create a new WeasyPrint instance and load an HTML string, file or view name. You can save it to a file, or inline (show in browser) or download.
Using the App container:
Or use the Facade to access easy helper methods.
Inline a PDF:
Or download:
You can chain the methods:
You can change the orientation and paper size
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.
See the php-weasyprint for more information/settings.
Testing - PDF fake
As an alternative to mocking, you may use the WeasyPrint
facade's fake
method. When using fakes, assertions are made after the code under test is executed:
Other available assertions:
License
This WeasyPrint Wrapper for Laravel is open-sourced software licensed under the MIT license
All versions of laravel-weasyprint with dependencies
illuminate/support Version ^9|^10|^11
illuminate/filesystem Version ^9|^10|^11
pontedilana/php-weasyprint Version ^1.3