https://github.com/basdegroot/phpwkhtmltopdflaravel
Laravel wrapper for the PHP WkHtmlToPdf library
https://github.com/basdegroot/phpwkhtmltopdflaravel
Last synced: 6 months ago
JSON representation
Laravel wrapper for the PHP WkHtmlToPdf library
- Host: GitHub
- URL: https://github.com/basdegroot/phpwkhtmltopdflaravel
- Owner: basdegroot
- Created: 2017-11-15T09:40:20.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-15T12:23:36.000Z (over 8 years ago)
- Last Synced: 2025-09-28T11:31:54.093Z (9 months ago)
- Language: PHP
- Size: 3.91 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# PHP WkHtmlToPdf Laravel Wrapper
This wrapper will include the [mikehaertl/phpwkhtmltopdf](https://github.com/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
## Installation
Install the package through [composer](http://getcomposer.org):
```
composer require basdegroot/phpwkhtmltopdflaravel
```
## Configuration
The application can be configured threw the .env file or by publishing the configuration files to your project.
### Publish
```
php artisan vendor:publish
```
### .env variables
```
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.
```
## Response
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.
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.