This wrapper will include the mikehaertl/phpwkhtmltopdf library. It will use the config functions of laravel and it can be configured threw the .env file. All the functions of the library of mikehaertl are available. https://github.com/mikehaertl/phpwkhtmltopdf
Install the package through composer:
composer require basdegroot/phpwkhtmltopdflaravel
The application can be configured threw the .env file or by publishing the configuration files to your project.
php artisan vendor:publish
WKHTMLTOPDF_BINARY = Path to the binary of the WkHtmlToPdf library. Default is 'wkhmltopdf'
WKHTMLTOPDF_INGORE_WARNINGS = Whether to ignore any errors if a PDF file was still created. Default is false
WKHTMLTOPDF_TMP_DIR = Path to tmp directory. Defaults to the PHP temp dir.
The class has an method which returns a Laravel response object with the PDF content + correct headers
use Basdegroot\PhpwkhtmltopdfLaravel\Pdf;
$pdf = new Pdf('http://www.google.nl');
return $pdf->response();
// or with a filename
return $pdf->response('filename');
The Pdf object extends \mikehaertl\wkhtmlto\Pdf so all the other methods are still available.
Please see CHANGELOG for more information what has changed recently.