Stand: SMTP-Test, Admin-Mail-Tab, Notifiable-Fix, Lazy-Quill
- Fix: Notifiable-Trait zum User-Model hinzugefuegt (behebt notify()-500er) - Installer: SMTP-Verbindungstest mit EsmtpTransport + Ueberspringen-Link - Admin: Neuer E-Mail-Tab mit SMTP-Konfiguration + Verbindungstest - Admin: Lazy Quill-Initialisierung (nur sichtbare Locale wird geladen) - Uebersetzungen: 17 neue Mail-Keys in allen 6 Sprachen Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
126
vendor/barryvdh/laravel-dompdf/CHANGELOG.md
vendored
Normal file
126
vendor/barryvdh/laravel-dompdf/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
[3.0.0]
|
||||
Version 3.x supports DomPDF version 3.x. See the changelog in https://github.com/dompdf/dompdf/releases/tag/v3.0.0
|
||||
|
||||
The most notable change in laravel-dompdf are the changed defaults, to be more secure;
|
||||
- `enable_remote` is now `false` by default. Change with caution.
|
||||
- `allowedRemoteHosts` and `artifactPathValidation` are added the the config.
|
||||
Also, support for Laravel < 9 and PHP < 8.1 is dropped.
|
||||
|
||||
## [3.1]
|
||||
This release updates the config for [dompdf/dompdf v3.1.0](https://github.com/dompdf/dompdf/releases/tag/v3.1.0) which contains the. following breaking URL:
|
||||
|
||||
> **Breaking Change**
|
||||
> This release adds the "data://" scheme to the protocol validation rules. Installations that explicitly define the allowed protocols but do not include the "data://" protocol will no longer render data-URIs. This is a change from previous versions, where data-URIs were not processed through the validated rules. Installations that use the default validation rules included with Dompdf should see no impact.
|
||||
|
||||
The update for laravel-dompdf adds this to the default config, but if you have published the config, you need to add the `data://` scheme.
|
||||
|
||||
## [3.0]
|
||||
|
||||
Version 3.x supports DomPDF version 3.x. See the changelog in https://github.com/dompdf/dompdf/releases/tag/v3.0.0
|
||||
|
||||
The most notable change in laravel-dompdf are the changed defaults, to be more secure;
|
||||
|
||||
enable_remote is now false by default. Change with caution.
|
||||
allowedRemoteHosts and artifactPathValidation are added the the config.
|
||||
Also, support for Laravel < 9 and PHP < 8.1 is dropped.
|
||||
|
||||
## [2.2.0]
|
||||
### What's Changed
|
||||
* Fix setOptions by @cesarreyes3 in https://github.com/barryvdh/laravel-dompdf/pull/1040
|
||||
* Bump dompdf minimum to 2.0.7 by @barryvdh
|
||||
|
||||
## New Contributors
|
||||
* @cesarreyes3 made their first contribution in https://github.com/barryvdh/laravel-dompdf/pull/1040
|
||||
|
||||
**Full Changelog**: https://github.com/barryvdh/laravel-dompdf/compare/v2.1.1...v2.2.0
|
||||
|
||||
## [2.1.1]
|
||||
### What's Changed
|
||||
* Revert "Fix setOptions method" by @barryvdh in https://github.com/barryvdh/laravel-dompdf/pull/1039
|
||||
|
||||
**Full Changelog**: https://github.com/barryvdh/laravel-dompdf/compare/v2.1.0...v2.1.1
|
||||
|
||||
## [2.1.0]
|
||||
### What's Changed
|
||||
* Convert phpunit by @barryvdh in https://github.com/barryvdh/laravel-dompdf/pull/952
|
||||
* ci: Use GitHub Actions V3 by @DannyvdSluijs in https://github.com/barryvdh/laravel-dompdf/pull/990
|
||||
* Fix named arguments when using facade by @erikn69 in https://github.com/barryvdh/laravel-dompdf/pull/1002
|
||||
* Update dompdf version as a dependancy by @AliSheikhDev in https://github.com/barryvdh/laravel-dompdf/pull/967
|
||||
* ci: Use GitHub Actions V4 by @erikn69 in https://github.com/barryvdh/laravel-dompdf/pull/1003
|
||||
* Fix phpstan analysis by @erikn69 in https://github.com/barryvdh/laravel-dompdf/pull/972
|
||||
* Fix setOptions method by @erikn69 in https://github.com/barryvdh/laravel-dompdf/pull/974
|
||||
* Small typo fix in dompdf config file by @ricklambrechts in https://github.com/barryvdh/laravel-dompdf/pull/1004
|
||||
* Upgrade to larastan/larastan by @parth391 in https://github.com/barryvdh/laravel-dompdf/pull/1014
|
||||
* Fixing "Upgrade to larastan/larastan" by @erikn69 in https://github.com/barryvdh/laravel-dompdf/pull/1018
|
||||
* Laravel 11 Support by @erikn69 in https://github.com/barryvdh/laravel-dompdf/pull/1036
|
||||
* Laravel 11.x Compatibility by @laravel-shift in https://github.com/barryvdh/laravel-dompdf/pull/1037
|
||||
|
||||
### New Contributors
|
||||
* @DannyvdSluijs made their first contribution in https://github.com/barryvdh/laravel-dompdf/pull/990
|
||||
* @AliSheikhDev made their first contribution in https://github.com/barryvdh/laravel-dompdf/pull/967
|
||||
* @ricklambrechts made their first contribution in https://github.com/barryvdh/laravel-dompdf/pull/1004
|
||||
* @parth391 made their first contribution in https://github.com/barryvdh/laravel-dompdf/pull/1014
|
||||
* @laravel-shift made their first contribution in https://github.com/barryvdh/laravel-dompdf/pull/1037
|
||||
|
||||
**Full Changelog**: https://github.com/barryvdh/laravel-dompdf/compare/v2.0.1...v2.0.2
|
||||
|
||||
## [2.0.0]
|
||||
|
||||
Version 2 supports DomPDF 2.x
|
||||
|
||||
### Changed
|
||||
- Remove the deprecated class 'Barryvdh\DomPDF\Facade' Facade in favor of Barryvdh\DomPDF\Facade\Pdf
|
||||
- Set default Facade to Pdf instead of PDF
|
||||
- HTML5 parser option is deprecated, because this is always on.
|
||||
- `orientation` option was never used. Removed in favor of `options.default_paper_orientation`
|
||||
|
||||
### Added
|
||||
- Upgraded to use dompdf/dompdf 2.x
|
||||
- `setOption` to change only the specified option(s), instead of replace all options.
|
||||
- Magic methods to allow calls to Dompdf methods easier. (#892)
|
||||
- `default_paper_orientation` option has been added to the defaults.
|
||||
- Add option to set public path (#890)
|
||||
|
||||
### Deprecated
|
||||
- `setOptions` is now deprecated. Use `setOption` instead.
|
||||
- Config `dompdf.defines` has been renamed to `dompdf.options`
|
||||
|
||||
|
||||
## [2.0.0-beta3]
|
||||
### Changed
|
||||
- Remove the deprecated class 'Barryvdh\DomPDF\Facade' Facade in favor of Barryvdh\DomPDF\Facade\Pdf
|
||||
- Set default Facade to Pdf instead of PDF
|
||||
|
||||
## [2.0.0-beta2]
|
||||
|
||||
### Added
|
||||
- Upgraded to use dompdf/dompdf 2.x
|
||||
- `setOption` to change only the specified option(s), instead of replace all options.
|
||||
- Magic methods to allow calls to Dompdf methods easier. (#892)
|
||||
- `default_paper_orientation` option has been added to the defaults.
|
||||
- Add option to set public path (#890)
|
||||
|
||||
### Changed
|
||||
- HTML5 parser option is deprecated, because this is always on.
|
||||
- `orientation` option was never used. Removed in favor of `options.default_paper_orientation`
|
||||
|
||||
### Deprecated
|
||||
- `setOptions` is now deprecated. Use `setOption` instead.
|
||||
- Config `dompdf.defines` has been renamed to `dompdf.options`
|
||||
|
||||
|
||||
## Dompdf 2.0.0, highlights since 1.2.x
|
||||
> https://github.com/dompdf/dompdf/releases/tag/v2.0.0
|
||||
> - Addresses multiple security vulnerabilities (see link)
|
||||
> - Modifies callback and page_script/page_text handling (breaking change, see link)
|
||||
> - Switches the HTML5 parser to Masterminds/HTML5
|
||||
> - Improves CSS property parsing and representation
|
||||
> - Improves border, outline, and background rendering for inline elements
|
||||
> - Switches installed fonts and font metrics cache file format to JSON
|
||||
> - Adds support for the inset CSS shorthand property and the legacy break-word keyword for word-break
|
||||
> - Adds "end_document" callback event
|
||||
21
vendor/barryvdh/laravel-dompdf/LICENSE
vendored
Normal file
21
vendor/barryvdh/laravel-dompdf/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 barryvdh
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
64
vendor/barryvdh/laravel-dompdf/composer.json
vendored
Normal file
64
vendor/barryvdh/laravel-dompdf/composer.json
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "barryvdh/laravel-dompdf",
|
||||
"description": "A DOMPDF Wrapper for Laravel",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"laravel",
|
||||
"dompdf",
|
||||
"pdf"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Barry vd. Heuvel",
|
||||
"email": "barryvdh@gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^8.1",
|
||||
"dompdf/dompdf": "^3.0",
|
||||
"illuminate/support": "^9|^10|^11|^12"
|
||||
},
|
||||
"require-dev": {
|
||||
"orchestra/testbench": "^7|^8|^9|^10",
|
||||
"squizlabs/php_codesniffer": "^3.5",
|
||||
"phpro/grumphp": "^2.5",
|
||||
"larastan/larastan": "^2.7|^3.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Barryvdh\\DomPDF\\": "src"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Barryvdh\\DomPDF\\Tests\\": "tests"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.0-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Barryvdh\\DomPDF\\ServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Pdf": "Barryvdh\\DomPDF\\Facade\\Pdf",
|
||||
"PDF": "Barryvdh\\DomPDF\\Facade\\Pdf"
|
||||
}
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"test": "phpunit",
|
||||
"check-style": "phpcs -p --standard=psr12 src/",
|
||||
"fix-style": "phpcbf -p --standard=psr12 src/",
|
||||
"phpstan": "phpstan analyze --memory-limit=-1"
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"phpro/grumphp": true
|
||||
}
|
||||
}
|
||||
}
|
||||
301
vendor/barryvdh/laravel-dompdf/config/dompdf.php
vendored
Normal file
301
vendor/barryvdh/laravel-dompdf/config/dompdf.php
vendored
Normal file
@@ -0,0 +1,301 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set some default values. It is possible to add all defines that can be set
|
||||
| in dompdf_config.inc.php. You can also override the entire config file.
|
||||
|
|
||||
*/
|
||||
'show_warnings' => false, // Throw an Exception on warnings from dompdf
|
||||
|
||||
'public_path' => null, // Override the public path if needed
|
||||
|
||||
/*
|
||||
* Dejavu Sans font is missing glyphs for converted entities, turn it off if you need to show € and £.
|
||||
*/
|
||||
'convert_entities' => true,
|
||||
|
||||
'options' => [
|
||||
/**
|
||||
* The location of the DOMPDF font directory
|
||||
*
|
||||
* The location of the directory where DOMPDF will store fonts and font metrics
|
||||
* Note: This directory must exist and be writable by the webserver process.
|
||||
* *Please note the trailing slash.*
|
||||
*
|
||||
* Notes regarding fonts:
|
||||
* Additional .afm font metrics can be added by executing load_font.php from command line.
|
||||
*
|
||||
* Only the original "Base 14 fonts" are present on all pdf viewers. Additional fonts must
|
||||
* be embedded in the pdf file or the PDF may not display correctly. This can significantly
|
||||
* increase file size unless font subsetting is enabled. Before embedding a font please
|
||||
* review your rights under the font license.
|
||||
*
|
||||
* Any font specification in the source HTML is translated to the closest font available
|
||||
* in the font directory.
|
||||
*
|
||||
* The pdf standard "Base 14 fonts" are:
|
||||
* Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique,
|
||||
* Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique,
|
||||
* Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic,
|
||||
* Symbol, ZapfDingbats.
|
||||
*/
|
||||
'font_dir' => storage_path('fonts'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782)
|
||||
|
||||
/**
|
||||
* The location of the DOMPDF font cache directory
|
||||
*
|
||||
* This directory contains the cached font metrics for the fonts used by DOMPDF.
|
||||
* This directory can be the same as DOMPDF_FONT_DIR
|
||||
*
|
||||
* Note: This directory must exist and be writable by the webserver process.
|
||||
*/
|
||||
'font_cache' => storage_path('fonts'),
|
||||
|
||||
/**
|
||||
* The location of a temporary directory.
|
||||
*
|
||||
* The directory specified must be writeable by the webserver process.
|
||||
* The temporary directory is required to download remote images and when
|
||||
* using the PDFLib back end.
|
||||
*/
|
||||
'temp_dir' => sys_get_temp_dir(),
|
||||
|
||||
/**
|
||||
* ==== IMPORTANT ====
|
||||
*
|
||||
* dompdf's "chroot": Prevents dompdf from accessing system files or other
|
||||
* files on the webserver. All local files opened by dompdf must be in a
|
||||
* subdirectory of this directory. DO NOT set it to '/' since this could
|
||||
* allow an attacker to use dompdf to read any files on the server. This
|
||||
* should be an absolute path.
|
||||
* This is only checked on command line call by dompdf.php, but not by
|
||||
* direct class use like:
|
||||
* $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output();
|
||||
*/
|
||||
'chroot' => realpath(base_path()),
|
||||
|
||||
/**
|
||||
* Protocol whitelist
|
||||
*
|
||||
* Protocols and PHP wrappers allowed in URIs, and the validation rules
|
||||
* that determine if a resouce may be loaded. Full support is not guaranteed
|
||||
* for the protocols/wrappers specified
|
||||
* by this array.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
'allowed_protocols' => [
|
||||
'data://' => ['rules' => []],
|
||||
'file://' => ['rules' => []],
|
||||
'http://' => ['rules' => []],
|
||||
'https://' => ['rules' => []],
|
||||
],
|
||||
|
||||
/**
|
||||
* Operational artifact (log files, temporary files) path validation
|
||||
*/
|
||||
'artifactPathValidation' => null,
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
'log_output_file' => null,
|
||||
|
||||
/**
|
||||
* Whether to enable font subsetting or not.
|
||||
*/
|
||||
'enable_font_subsetting' => false,
|
||||
|
||||
/**
|
||||
* The PDF rendering backend to use
|
||||
*
|
||||
* Valid settings are 'PDFLib', 'CPDF' (the bundled R&OS PDF class), 'GD' and
|
||||
* 'auto'. 'auto' will look for PDFLib and use it if found, or if not it will
|
||||
* fall back on CPDF. 'GD' renders PDFs to graphic files.
|
||||
* {@link * Canvas_Factory} ultimately determines which rendering class to
|
||||
* instantiate based on this setting.
|
||||
*
|
||||
* Both PDFLib & CPDF rendering backends provide sufficient rendering
|
||||
* capabilities for dompdf, however additional features (e.g. object,
|
||||
* image and font support, etc.) differ between backends. Please see
|
||||
* {@link PDFLib_Adapter} for more information on the PDFLib backend
|
||||
* and {@link CPDF_Adapter} and lib/class.pdf.php for more information
|
||||
* on CPDF. Also see the documentation for each backend at the links
|
||||
* below.
|
||||
*
|
||||
* The GD rendering backend is a little different than PDFLib and
|
||||
* CPDF. Several features of CPDF and PDFLib are not supported or do
|
||||
* not make any sense when creating image files. For example,
|
||||
* multiple pages are not supported, nor are PDF 'objects'. Have a
|
||||
* look at {@link GD_Adapter} for more information. GD support is
|
||||
* experimental, so use it at your own risk.
|
||||
*
|
||||
* @link http://www.pdflib.com
|
||||
* @link http://www.ros.co.nz/pdf
|
||||
* @link http://www.php.net/image
|
||||
*/
|
||||
'pdf_backend' => 'CPDF',
|
||||
|
||||
/**
|
||||
* html target media view which should be rendered into pdf.
|
||||
* List of types and parsing rules for future extensions:
|
||||
* http://www.w3.org/TR/REC-html40/types.html
|
||||
* screen, tty, tv, projection, handheld, print, braille, aural, all
|
||||
* Note: aural is deprecated in CSS 2.1 because it is replaced by speech in CSS 3.
|
||||
* Note, even though the generated pdf file is intended for print output,
|
||||
* the desired content might be different (e.g. screen or projection view of html file).
|
||||
* Therefore allow specification of content here.
|
||||
*/
|
||||
'default_media_type' => 'screen',
|
||||
|
||||
/**
|
||||
* The default paper size.
|
||||
*
|
||||
* North America standard is "letter"; other countries generally "a4"
|
||||
*
|
||||
* @see CPDF_Adapter::PAPER_SIZES for valid sizes ('letter', 'legal', 'A4', etc.)
|
||||
*/
|
||||
'default_paper_size' => 'a4',
|
||||
|
||||
/**
|
||||
* The default paper orientation.
|
||||
*
|
||||
* The orientation of the page (portrait or landscape).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
'default_paper_orientation' => 'portrait',
|
||||
|
||||
/**
|
||||
* The default font family
|
||||
*
|
||||
* Used if no suitable fonts can be found. This must exist in the font folder.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
'default_font' => 'serif',
|
||||
|
||||
/**
|
||||
* Image DPI setting
|
||||
*
|
||||
* This setting determines the default DPI setting for images and fonts. The
|
||||
* DPI may be overridden for inline images by explictly setting the
|
||||
* image's width & height style attributes (i.e. if the image's native
|
||||
* width is 600 pixels and you specify the image's width as 72 points,
|
||||
* the image will have a DPI of 600 in the rendered PDF. The DPI of
|
||||
* background images can not be overridden and is controlled entirely
|
||||
* via this parameter.
|
||||
*
|
||||
* For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI).
|
||||
* If a size in html is given as px (or without unit as image size),
|
||||
* this tells the corresponding size in pt.
|
||||
* This adjusts the relative sizes to be similar to the rendering of the
|
||||
* html page in a reference browser.
|
||||
*
|
||||
* In pdf, always 1 pt = 1/72 inch
|
||||
*
|
||||
* Rendering resolution of various browsers in px per inch:
|
||||
* Windows Firefox and Internet Explorer:
|
||||
* SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:?
|
||||
* Linux Firefox:
|
||||
* about:config *resolution: Default:96
|
||||
* (xorg screen dimension in mm and Desktop font dpi settings are ignored)
|
||||
*
|
||||
* Take care about extra font/image zoom factor of browser.
|
||||
*
|
||||
* In images, <img> size in pixel attribute, img css style, are overriding
|
||||
* the real image dimension in px for rendering.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
'dpi' => 96,
|
||||
|
||||
/**
|
||||
* Enable embedded PHP
|
||||
*
|
||||
* If this setting is set to true then DOMPDF will automatically evaluate embedded PHP contained
|
||||
* within <script type="text/php"> ... </script> tags.
|
||||
*
|
||||
* ==== IMPORTANT ==== Enabling this for documents you do not trust (e.g. arbitrary remote html pages)
|
||||
* is a security risk.
|
||||
* Embedded scripts are run with the same level of system access available to dompdf.
|
||||
* Set this option to false (recommended) if you wish to process untrusted documents.
|
||||
* This setting may increase the risk of system exploit.
|
||||
* Do not change this settings without understanding the consequences.
|
||||
* Additional documentation is available on the dompdf wiki at:
|
||||
* https://github.com/dompdf/dompdf/wiki
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
'enable_php' => false,
|
||||
|
||||
/**
|
||||
* Rnable inline JavaScript
|
||||
*
|
||||
* If this setting is set to true then DOMPDF will automatically insert JavaScript code contained
|
||||
* within <script type="text/javascript"> ... </script> tags as written into the PDF.
|
||||
* NOTE: This is PDF-based JavaScript to be executed by the PDF viewer,
|
||||
* not browser-based JavaScript executed by Dompdf.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
'enable_javascript' => true,
|
||||
|
||||
/**
|
||||
* Enable remote file access
|
||||
*
|
||||
* If this setting is set to true, DOMPDF will access remote sites for
|
||||
* images and CSS files as required.
|
||||
*
|
||||
* ==== IMPORTANT ====
|
||||
* This can be a security risk, in particular in combination with isPhpEnabled and
|
||||
* allowing remote html code to be passed to $dompdf = new DOMPDF(); $dompdf->load_html(...);
|
||||
* This allows anonymous users to download legally doubtful internet content which on
|
||||
* tracing back appears to being downloaded by your server, or allows malicious php code
|
||||
* in remote html pages to be executed by your server with your account privileges.
|
||||
*
|
||||
* This setting may increase the risk of system exploit. Do not change
|
||||
* this settings without understanding the consequences. Additional
|
||||
* documentation is available on the dompdf wiki at:
|
||||
* https://github.com/dompdf/dompdf/wiki
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
'enable_remote' => false,
|
||||
|
||||
/**
|
||||
* List of allowed remote hosts
|
||||
*
|
||||
* Each value of the array must be a valid hostname.
|
||||
*
|
||||
* This will be used to filter which resources can be loaded in combination with
|
||||
* isRemoteEnabled. If enable_remote is FALSE, then this will have no effect.
|
||||
*
|
||||
* Leave to NULL to allow any remote host.
|
||||
*
|
||||
* @var array|null
|
||||
*/
|
||||
'allowed_remote_hosts' => null,
|
||||
|
||||
/**
|
||||
* A ratio applied to the fonts height to be more like browsers' line height
|
||||
*/
|
||||
'font_height_ratio' => 1.1,
|
||||
|
||||
/**
|
||||
* Use the HTML5 Lib parser
|
||||
*
|
||||
* @deprecated This feature is now always on in dompdf 2.x
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
'enable_html5_parser' => true,
|
||||
],
|
||||
|
||||
];
|
||||
134
vendor/barryvdh/laravel-dompdf/readme.md
vendored
Normal file
134
vendor/barryvdh/laravel-dompdf/readme.md
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
## DOMPDF Wrapper for Laravel
|
||||
|
||||
### Laravel wrapper for [Dompdf HTML to PDF Converter](https://github.com/dompdf/dompdf)
|
||||
|
||||
[](https://github.com/barryvdh/laravel-dompdf/actions)
|
||||
[](http://choosealicense.com/licenses/mit/)
|
||||
[](https://packagist.org/packages/barryvdh/laravel-dompdf)
|
||||
[](https://packagist.org/packages/barryvdh/laravel-dompdf)
|
||||
[](https://fruitcake.nl/)
|
||||
|
||||
## Installation
|
||||
|
||||
### Laravel
|
||||
Require this package in your composer.json and update composer. This will download the package and the dompdf + fontlib libraries also.
|
||||
|
||||
composer require barryvdh/laravel-dompdf
|
||||
|
||||
### Lumen
|
||||
|
||||
After updating composer add the following lines to register provider in `bootstrap/app.php`
|
||||
|
||||
```
|
||||
$app->register(\Barryvdh\DomPDF\ServiceProvider::class);
|
||||
```
|
||||
|
||||
To change the configuration, copy the config file to your config folder and enable it in `bootstrap/app.php`:
|
||||
|
||||
```
|
||||
$app->configure('dompdf');
|
||||
```
|
||||
|
||||
## Using
|
||||
|
||||
You can create a new DOMPDF instance and load a HTML string, file or view name. You can save it to a file, or stream (show in browser) or download.
|
||||
|
||||
```php
|
||||
use Barryvdh\DomPDF\Facade\Pdf;
|
||||
|
||||
$pdf = Pdf::loadView('pdf.invoice', $data);
|
||||
return $pdf->download('invoice.pdf');
|
||||
```
|
||||
|
||||
or use the App container:
|
||||
|
||||
```php
|
||||
$pdf = App::make('dompdf.wrapper');
|
||||
$pdf->loadHTML('<h1>Test</h1>');
|
||||
return $pdf->stream();
|
||||
```
|
||||
|
||||
Or use the facade:
|
||||
|
||||
You can chain the methods:
|
||||
|
||||
```php
|
||||
return Pdf::loadFile(public_path().'/myfile.html')->save('/path-to/my_stored_file.pdf')->stream('download.pdf');
|
||||
```
|
||||
|
||||
You can change the orientation and paper size, and hide or show errors (by default, errors are shown when debug is on)
|
||||
|
||||
```php
|
||||
Pdf::loadHTML($html)->setPaper('a4', 'landscape')->setWarnings(false)->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.
|
||||
|
||||
Use `php artisan vendor:publish` to create a config file located at `config/dompdf.php` which will allow you to define local configurations to change some settings (default paper etc).
|
||||
You can also use your ConfigProvider to set certain keys.
|
||||
|
||||
### Configuration
|
||||
The defaults configuration settings are set in `config/dompdf.php`. Copy this file to your own config directory to modify the values. You can publish the config using this command:
|
||||
```shell
|
||||
php artisan vendor:publish --provider="Barryvdh\DomPDF\ServiceProvider"
|
||||
```
|
||||
|
||||
You can still alter the dompdf options in your code before generating the pdf using this command:
|
||||
```php
|
||||
Pdf::setOption(['dpi' => 150, 'defaultFont' => 'sans-serif']);
|
||||
```
|
||||
|
||||
Available options and their defaults:
|
||||
* __rootDir__: "{app_directory}/vendor/dompdf/dompdf"
|
||||
* __tempDir__: "/tmp" _(available in config/dompdf.php)_
|
||||
* __fontDir__: "{app_directory}/storage/fonts" _(available in config/dompdf.php)_
|
||||
* __fontCache__: "{app_directory}/storage/fonts" _(available in config/dompdf.php)_
|
||||
* __chroot__: "{app_directory}" _(available in config/dompdf.php)_
|
||||
* __logOutputFile__: "/tmp/log.htm"
|
||||
* __defaultMediaType__: "screen" _(available in config/dompdf.php)_
|
||||
* __defaultPaperSize__: "a4" _(available in config/dompdf.php)_
|
||||
* __defaultFont__: "serif" _(available in config/dompdf.php)_
|
||||
* __dpi__: 96 _(available in config/dompdf.php)_
|
||||
* __fontHeightRatio__: 1.1 _(available in config/dompdf.php)_
|
||||
* __isPhpEnabled__: false _(available in config/dompdf.php)_
|
||||
* __isRemoteEnabled__: false _(available in config/dompdf.php)_
|
||||
* __isJavascriptEnabled__: true _(available in config/dompdf.php)_
|
||||
* __isHtml5ParserEnabled__: true _(available in config/dompdf.php)_
|
||||
* __allowedRemoteHosts__: null _(available in config/dompdf.php)_
|
||||
* __isFontSubsettingEnabled__: false _(available in config/dompdf.php)_
|
||||
* __debugPng__: false
|
||||
* __debugKeepTemp__: false
|
||||
* __debugCss__: false
|
||||
* __debugLayout__: false
|
||||
* __debugLayoutLines__: true
|
||||
* __debugLayoutBlocks__: true
|
||||
* __debugLayoutInline__: true
|
||||
* __debugLayoutPaddingBox__: true
|
||||
* __pdfBackend__: "CPDF" _(available in config/dompdf.php)_
|
||||
* __pdflibLicense__: ""
|
||||
* __adminUsername__: "user"
|
||||
* __adminPassword__: "password"
|
||||
* __artifactPathValidation__: null _(available in config/dompdf.php)_
|
||||
|
||||
#### Note: Since 3.x the remote access is disabled by default, to provide more security. Use with caution!
|
||||
|
||||
### Tip: UTF-8 support
|
||||
In your templates, set the UTF-8 Metatag:
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
|
||||
### Tip: Page breaks
|
||||
You can use the CSS `page-break-before`/`page-break-after` properties to create a new page.
|
||||
|
||||
<style>
|
||||
.page-break {
|
||||
page-break-after: always;
|
||||
}
|
||||
</style>
|
||||
<h1>Page 1</h1>
|
||||
<div class="page-break"></div>
|
||||
<h1>Page 2</h1>
|
||||
|
||||
### License
|
||||
|
||||
This DOMPDF Wrapper for Laravel is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)
|
||||
68
vendor/barryvdh/laravel-dompdf/src/Facade/Pdf.php
vendored
Normal file
68
vendor/barryvdh/laravel-dompdf/src/Facade/Pdf.php
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace Barryvdh\DomPDF\Facade;
|
||||
|
||||
use Barryvdh\DomPDF\PDF as BasePDF;
|
||||
use Illuminate\Support\Facades\Facade as IlluminateFacade;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* @method static BasePDF setBaseHost(string $baseHost)
|
||||
* @method static BasePDF setBasePath(string $basePath)
|
||||
* @method static BasePDF setCanvas(\Dompdf\Canvas $canvas)
|
||||
* @method static BasePDF setCallbacks(array<string, mixed> $callbacks)
|
||||
* @method static BasePDF setCss(\Dompdf\Css\Stylesheet $css)
|
||||
* @method static BasePDF setDefaultView(string $defaultView, array<string, mixed> $options)
|
||||
* @method static BasePDF setDom(\DOMDocument $dom)
|
||||
* @method static BasePDF setFontMetrics(\Dompdf\FontMetrics $fontMetrics)
|
||||
* @method static BasePDF setHttpContext(resource|array<string, mixed> $httpContext)
|
||||
* @method static BasePDF setPaper(string|float[] $paper, string $orientation = 'portrait')
|
||||
* @method static BasePDF setProtocol(string $protocol)
|
||||
* @method static BasePDF setTree(\Dompdf\Frame\FrameTree $tree)
|
||||
* @method static BasePDF setWarnings(bool $warnings)
|
||||
* @method static BasePDF setOption(array<string, mixed>|string $attribute, $value = null)
|
||||
* @method static BasePDF setOptions(array<string, mixed> $options)
|
||||
* @method static BasePDF loadView(string $view, array<string, mixed> $data = [], array<string, mixed> $mergeData = [], ?string $encoding = null)
|
||||
* @method static BasePDF loadHTML(string $string, ?string $encoding = null)
|
||||
* @method static BasePDF loadFile(string $file)
|
||||
* @method static BasePDF addInfo(array<string, string> $info)
|
||||
* @method static string output(array<string, int> $options = [])
|
||||
* @method static BasePDF save()
|
||||
* @method static \Illuminate\Http\Response download(string $filename = 'document.pdf')
|
||||
* @method static \Illuminate\Http\Response stream(string $filename = 'document.pdf')
|
||||
*/
|
||||
class Pdf extends IlluminateFacade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'dompdf.wrapper';
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle dynamic, static calls to the object.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array<mixed> $args
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public static function __callStatic($method, $args)
|
||||
{
|
||||
/** @var \Illuminate\Contracts\Foundation\Application|null */
|
||||
$app = static::getFacadeApplication();
|
||||
if (! $app) {
|
||||
throw new RuntimeException('Facade application has not been set.');
|
||||
}
|
||||
|
||||
// Resolve a new instance, avoid using a cached instance
|
||||
$instance = $app->make(static::getFacadeAccessor());
|
||||
|
||||
return $instance->$method(...$args);
|
||||
}
|
||||
}
|
||||
319
vendor/barryvdh/laravel-dompdf/src/PDF.php
vendored
Normal file
319
vendor/barryvdh/laravel-dompdf/src/PDF.php
vendored
Normal file
@@ -0,0 +1,319 @@
|
||||
<?php
|
||||
|
||||
namespace Barryvdh\DomPDF;
|
||||
|
||||
use Dompdf\Adapter\CPDF;
|
||||
use Dompdf\Dompdf;
|
||||
use Dompdf\Options;
|
||||
use Exception;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Contracts\View\Factory as ViewFactory;
|
||||
use Illuminate\Contracts\Config\Repository as ConfigRepository;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use Symfony\Component\HttpFoundation\HeaderUtils;
|
||||
|
||||
/**
|
||||
* A Laravel wrapper for Dompdf
|
||||
*
|
||||
* @package laravel-dompdf
|
||||
* @author Barry vd. Heuvel
|
||||
*
|
||||
* @method PDF setBaseHost(string $baseHost)
|
||||
* @method PDF setBasePath(string $basePath)
|
||||
* @method PDF setCanvas(\Dompdf\Canvas $canvas)
|
||||
* @method PDF setCallbacks(array<string, mixed> $callbacks)
|
||||
* @method PDF setCss(\Dompdf\Css\Stylesheet $css)
|
||||
* @method PDF setDefaultView(string $defaultView, array<string, mixed> $options)
|
||||
* @method PDF setDom(\DOMDocument $dom)
|
||||
* @method PDF setFontMetrics(\Dompdf\FontMetrics $fontMetrics)
|
||||
* @method PDF setHttpContext(resource|array<string, mixed> $httpContext)
|
||||
* @method PDF setPaper(string|float[] $paper, string $orientation = 'portrait')
|
||||
* @method PDF setProtocol(string $protocol)
|
||||
* @method PDF setTree(\Dompdf\Frame\FrameTree $tree)
|
||||
* @method string getBaseHost()
|
||||
* @method string getBasePath()
|
||||
* @method \Dompdf\Canvas getCanvas()
|
||||
* @method array<string, mixed> getCallbacks()
|
||||
* @method \Dompdf\Css\Stylesheet getCss()
|
||||
* @method \DOMDocument getDom()
|
||||
* @method \Dompdf\FontMetrics getFontMetrics()
|
||||
* @method resource getHttpContext()
|
||||
* @method Options getOptions()
|
||||
* @method \Dompdf\Frame\FrameTree getTree()
|
||||
* @method string getPaperOrientation()
|
||||
* @method float[] getPaperSize()
|
||||
* @method string getProtocol()
|
||||
*/
|
||||
class PDF
|
||||
{
|
||||
/** @var Dompdf */
|
||||
protected $dompdf;
|
||||
|
||||
/** @var \Illuminate\Contracts\Config\Repository */
|
||||
protected $config;
|
||||
|
||||
/** @var \Illuminate\Filesystem\Filesystem */
|
||||
protected $files;
|
||||
|
||||
/** @var \Illuminate\Contracts\View\Factory */
|
||||
protected $view;
|
||||
|
||||
/** @var bool */
|
||||
protected $rendered = false;
|
||||
|
||||
/** @var bool */
|
||||
protected $showWarnings;
|
||||
|
||||
/** @var string */
|
||||
protected $public_path;
|
||||
|
||||
public function __construct(Dompdf $dompdf, ConfigRepository $config, Filesystem $files, ViewFactory $view)
|
||||
{
|
||||
$this->dompdf = $dompdf;
|
||||
$this->config = $config;
|
||||
$this->files = $files;
|
||||
$this->view = $view;
|
||||
|
||||
$this->showWarnings = $this->config->get('dompdf.show_warnings', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the DomPDF instance
|
||||
*/
|
||||
public function getDomPDF(): Dompdf
|
||||
{
|
||||
return $this->dompdf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show or hide warnings
|
||||
*/
|
||||
public function setWarnings(bool $warnings): self
|
||||
{
|
||||
$this->showWarnings = $warnings;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a HTML string
|
||||
*
|
||||
* @param string|null $encoding Not used yet
|
||||
*/
|
||||
public function loadHTML(string $string, ?string $encoding = null): self
|
||||
{
|
||||
$string = $this->convertEntities($string);
|
||||
$this->dompdf->loadHtml($string, $encoding);
|
||||
$this->rendered = false;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a HTML file
|
||||
*/
|
||||
public function loadFile(string $file): self
|
||||
{
|
||||
$this->dompdf->loadHtmlFile($file);
|
||||
$this->rendered = false;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add metadata info
|
||||
* @param array<string, string> $info
|
||||
*/
|
||||
public function addInfo(array $info): self
|
||||
{
|
||||
foreach ($info as $name => $value) {
|
||||
$this->dompdf->add_info($name, $value);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a View and convert to HTML
|
||||
* @param array<string, mixed> $data
|
||||
* @param array<string, mixed> $mergeData
|
||||
* @param string|null $encoding Not used yet
|
||||
*/
|
||||
public function loadView(string $view, array $data = [], array $mergeData = [], ?string $encoding = null): self
|
||||
{
|
||||
$html = $this->view->make($view, $data, $mergeData)->render();
|
||||
return $this->loadHTML($html, $encoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set/Change an option (or array of options) in Dompdf
|
||||
*
|
||||
* @param array<string, mixed>|string $attribute
|
||||
* @param null|mixed $value
|
||||
*/
|
||||
public function setOption($attribute, $value = null): self
|
||||
{
|
||||
$this->dompdf->getOptions()->set($attribute, $value);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace all the Options from DomPDF
|
||||
*
|
||||
* @param array<string, mixed> $options
|
||||
*/
|
||||
public function setOptions(array $options, bool $mergeWithDefaults = false): self
|
||||
{
|
||||
if ($mergeWithDefaults) {
|
||||
$options = array_merge(app()->make('dompdf.options'), $options);
|
||||
}
|
||||
|
||||
$this->dompdf->setOptions(new Options($options));
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the PDF as a string.
|
||||
*
|
||||
* The options parameter controls the output. Accepted options are:
|
||||
*
|
||||
* 'compress' = > 1 or 0 - apply content stream compression, this is
|
||||
* on (1) by default
|
||||
*
|
||||
* @param array<string, int> $options
|
||||
*
|
||||
* @return string The rendered PDF as string
|
||||
*/
|
||||
public function output(array $options = []): string
|
||||
{
|
||||
if (!$this->rendered) {
|
||||
$this->render();
|
||||
}
|
||||
return (string) $this->dompdf->output($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the PDF to a file
|
||||
*/
|
||||
public function save(string $filename, ?string $disk = null): self
|
||||
{
|
||||
$disk = $disk ?: $this->config->get('dompdf.disk');
|
||||
|
||||
if (! is_null($disk)) {
|
||||
Storage::disk($disk)->put($filename, $this->output());
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->files->put($filename, $this->output());
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the PDF downloadable by the user
|
||||
*/
|
||||
public function download(string $filename = 'document.pdf'): Response
|
||||
{
|
||||
$output = $this->output();
|
||||
$fallback = $this->fallbackName($filename);
|
||||
|
||||
return new Response($output, 200, [
|
||||
'Content-Type' => 'application/pdf',
|
||||
'Content-Disposition' => HeaderUtils::makeDisposition('attachment', $filename, $fallback),
|
||||
'Content-Length' => strlen($output),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a response with the PDF to show in the browser
|
||||
*/
|
||||
public function stream(string $filename = 'document.pdf'): Response
|
||||
{
|
||||
$output = $this->output();
|
||||
$fallback = $this->fallbackName($filename);
|
||||
|
||||
|
||||
return new Response($output, 200, [
|
||||
'Content-Type' => 'application/pdf',
|
||||
'Content-Disposition' => HeaderUtils::makeDisposition('inline', $filename, $fallback),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the PDF
|
||||
*/
|
||||
public function render(): void
|
||||
{
|
||||
$this->dompdf->render();
|
||||
|
||||
if ($this->showWarnings) {
|
||||
global $_dompdf_warnings;
|
||||
if (!empty($_dompdf_warnings) && count($_dompdf_warnings)) {
|
||||
$warnings = '';
|
||||
foreach ($_dompdf_warnings as $msg) {
|
||||
$warnings .= $msg . "\n";
|
||||
}
|
||||
// $warnings .= $this->dompdf->get_canvas()->get_cpdf()->messages;
|
||||
if (!empty($warnings)) {
|
||||
throw new Exception($warnings);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->rendered = true;
|
||||
}
|
||||
|
||||
/** @param array<string> $pc */
|
||||
public function setEncryption(string $password, string $ownerpassword = '', array $pc = []): void
|
||||
{
|
||||
$this->render();
|
||||
$canvas = $this->dompdf->getCanvas();
|
||||
if (! $canvas instanceof CPDF) {
|
||||
throw new \RuntimeException('Encryption is only supported when using CPDF');
|
||||
}
|
||||
$canvas->get_cpdf()->setEncryption($password, $ownerpassword, $pc);
|
||||
}
|
||||
|
||||
protected function convertEntities(string $subject): string
|
||||
{
|
||||
if (false === $this->config->get('dompdf.convert_entities', true)) {
|
||||
return $subject;
|
||||
}
|
||||
|
||||
$entities = [
|
||||
'€' => '€',
|
||||
'£' => '£',
|
||||
];
|
||||
|
||||
foreach ($entities as $search => $replace) {
|
||||
$subject = str_replace($search, $replace, $subject);
|
||||
}
|
||||
return $subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically handle calls into the dompdf instance.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array<mixed> $parameters
|
||||
* @return $this|mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
if (method_exists($this, $method)) {
|
||||
return $this->$method(...$parameters);
|
||||
}
|
||||
|
||||
if (method_exists($this->dompdf, $method)) {
|
||||
$return = $this->dompdf->$method(...$parameters);
|
||||
|
||||
return $return == $this->dompdf ? $this : $return;
|
||||
}
|
||||
|
||||
throw new \UnexpectedValueException("Method [{$method}] does not exist on PDF instance.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a safe fallback filename
|
||||
*/
|
||||
protected function fallbackName(string $filename): string
|
||||
{
|
||||
return str_replace('%', '', Str::ascii($filename));
|
||||
}
|
||||
}
|
||||
94
vendor/barryvdh/laravel-dompdf/src/ServiceProvider.php
vendored
Normal file
94
vendor/barryvdh/laravel-dompdf/src/ServiceProvider.php
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace Barryvdh\DomPDF;
|
||||
|
||||
use Dompdf\Dompdf;
|
||||
use Exception;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\ServiceProvider as IlluminateServiceProvider;
|
||||
|
||||
class ServiceProvider extends IlluminateServiceProvider
|
||||
{
|
||||
/**
|
||||
* Indicates if loading of the provider is deferred.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $defer = false;
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @throws \Exception
|
||||
* @return void
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$configPath = __DIR__ . '/../config/dompdf.php';
|
||||
$this->mergeConfigFrom($configPath, 'dompdf');
|
||||
|
||||
$this->app->bind('dompdf.options', function ($app) {
|
||||
$defines = $app['config']->get('dompdf.defines');
|
||||
|
||||
if ($defines) {
|
||||
$options = [];
|
||||
/**
|
||||
* @var string $key
|
||||
* @var mixed $value
|
||||
*/
|
||||
foreach ($defines as $key => $value) {
|
||||
$key = strtolower(str_replace('DOMPDF_', '', $key));
|
||||
$options[$key] = $value;
|
||||
}
|
||||
} else {
|
||||
$options = $app['config']->get('dompdf.options');
|
||||
}
|
||||
|
||||
return $options;
|
||||
});
|
||||
|
||||
$this->app->bind('dompdf', function ($app) {
|
||||
|
||||
$options = $app->make('dompdf.options');
|
||||
$dompdf = new Dompdf($options);
|
||||
$path = realpath($app['config']->get('dompdf.public_path') ?: base_path('public'));
|
||||
if ($path === false) {
|
||||
throw new \RuntimeException('Cannot resolve public path');
|
||||
}
|
||||
$dompdf->setBasePath($path);
|
||||
|
||||
return $dompdf;
|
||||
});
|
||||
$this->app->alias('dompdf', Dompdf::class);
|
||||
|
||||
$this->app->bind('dompdf.wrapper', function ($app) {
|
||||
return new PDF($app['dompdf'], $app['config'], $app['files'], $app['view']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if package is running under Lumen app
|
||||
*/
|
||||
protected function isLumen(): bool
|
||||
{
|
||||
return Str::contains($this->app->version(), 'Lumen') === true;
|
||||
}
|
||||
|
||||
public function boot(): void
|
||||
{
|
||||
if (! $this->isLumen()) {
|
||||
$configPath = __DIR__ . '/../config/dompdf.php';
|
||||
$this->publishes([$configPath => config_path('dompdf.php')], 'config');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array<string>
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return ['dompdf', 'dompdf.options', 'dompdf.wrapper'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user