From: Benjamin Bock Date: Sun, 17 Dec 2023 16:03:39 +0000 (+0100) Subject: Migrate Snappy to composer X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=abb4d9c8cfa9f19f71ebdd1f717222f996422f99;p=civicrm-core.git Migrate Snappy to composer --- diff --git a/CRM/Utils/PDF/Utils.php b/CRM/Utils/PDF/Utils.php index 2088228efd..5051dff502 100644 --- a/CRM/Utils/PDF/Utils.php +++ b/CRM/Utils/PDF/Utils.php @@ -188,7 +188,6 @@ class CRM_Utils_PDF_Utils { * @param string $fileName */ public static function _html2pdf_wkhtmltopdf($paper_size, $orientation, $margins, $html, $output, $fileName) { - require_once 'snappy/src/autoload.php'; $snappy = new Knp\Snappy\Pdf(\Civi::settings()->get('wkhtmltopdfPath')); $snappy->setOption("page-width", $paper_size[2] . "pt"); $snappy->setOption("page-height", $paper_size[3] . "pt"); diff --git a/composer.json b/composer.json index bf26986b7c..6ae04514df 100644 --- a/composer.json +++ b/composer.json @@ -103,7 +103,8 @@ "soundasleep/html2text": "^2.1", "psr/container": "~1.0 || ~2.0", "ext-fileinfo": "*", - "pontedilana/php-weasyprint": "^0.13.0" + "pontedilana/php-weasyprint": "^0.13.0", + "knplabs/knp-snappy": "^1.4" }, "scripts": { "post-install-cmd": [ diff --git a/composer.lock b/composer.lock index 1894da772f..68875a0e81 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c9993b57bd24c49e8ca63b6237ab89d5", + "content-hash": "a85ba6e6b1dda6e40fb5478865870489", "packages": [ { "name": "adrienrn/php-mimetyper", @@ -985,6 +985,80 @@ ], "time": "2023-04-17T16:00:37+00:00" }, + { + "name": "knplabs/knp-snappy", + "version": "v1.4.4", + "source": { + "type": "git", + "url": "https://github.com/KnpLabs/snappy.git", + "reference": "3db13fe45d12a7bccb2b83f622e5a90f7e40b111" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/KnpLabs/snappy/zipball/3db13fe45d12a7bccb2b83f622e5a90f7e40b111", + "reference": "3db13fe45d12a7bccb2b83f622e5a90f7e40b111", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "psr/log": "^1.0||^2.0||^3.0", + "symfony/process": "~3.4||~4.3||~5.0||~6.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.16||^3.0", + "pedrotroller/php-cs-custom-fixer": "^2.19", + "phpstan/phpstan": "^1.0.0", + "phpstan/phpstan-phpunit": "^1.0.0", + "phpunit/phpunit": "~7.4||~8.5" + }, + "suggest": { + "h4cc/wkhtmltoimage-amd64": "Provides wkhtmltoimage-amd64 binary for Linux-compatible machines, use version `~0.12` as dependency", + "h4cc/wkhtmltoimage-i386": "Provides wkhtmltoimage-i386 binary for Linux-compatible machines, use version `~0.12` as dependency", + "h4cc/wkhtmltopdf-amd64": "Provides wkhtmltopdf-amd64 binary for Linux-compatible machines, use version `~0.12` as dependency", + "h4cc/wkhtmltopdf-i386": "Provides wkhtmltopdf-i386 binary for Linux-compatible machines, use version `~0.12` as dependency", + "wemersonjanuario/wkhtmltopdf-windows": "Provides wkhtmltopdf executable for Windows, use version `~0.12` as dependency" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Knp\\Snappy\\": "src/Knp/Snappy" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "KNP Labs Team", + "homepage": "http://knplabs.com" + }, + { + "name": "Symfony Community", + "homepage": "http://github.com/KnpLabs/snappy/contributors" + } + ], + "description": "PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage.", + "homepage": "http://github.com/KnpLabs/snappy", + "keywords": [ + "knp", + "knplabs", + "pdf", + "snapshot", + "thumbnail", + "wkhtmltopdf" + ], + "support": { + "issues": "https://github.com/KnpLabs/snappy/issues", + "source": "https://github.com/KnpLabs/snappy/tree/v1.4.4" + }, + "time": "2023-09-13T12:18:19+00:00" + }, { "name": "laminas/laminas-escaper", "version": "2.6.1",