Remove spatie/browsershot

This commit is contained in:
Benjamin Beganović 2020-12-23 16:17:05 +01:00
parent 6625bd3943
commit d1682dd928
3 changed files with 7 additions and 404 deletions

View File

@ -62,7 +62,6 @@
"omnipay/paypal": "^3.0", "omnipay/paypal": "^3.0",
"predis/predis": "^1.1", "predis/predis": "^1.1",
"sentry/sentry-laravel": "^2", "sentry/sentry-laravel": "^2",
"spatie/browsershot": "3.40.2",
"stripe/stripe-php": "^7.50", "stripe/stripe-php": "^7.50",
"turbo124/beacon": "^1", "turbo124/beacon": "^1",
"turbo124/laravel-gmail": "^5.0", "turbo124/laravel-gmail": "^5.0",

305
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "669af9e67b79e872aa671420cfb14ddd", "content-hash": "304401db428800e3f176f946f22ee2f6",
"packages": [ "packages": [
{ {
"name": "asgrim/ofxparser", "name": "asgrim/ofxparser",
@ -3594,71 +3594,6 @@
}, },
"time": "2017-06-12T11:04:56+00:00" "time": "2017-06-12T11:04:56+00:00"
}, },
{
"name": "league/glide",
"version": "1.7.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/glide.git",
"reference": "ae5e26700573cb678919d28e425a8b87bc71c546"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/glide/zipball/ae5e26700573cb678919d28e425a8b87bc71c546",
"reference": "ae5e26700573cb678919d28e425a8b87bc71c546",
"shasum": ""
},
"require": {
"intervention/image": "^2.4",
"league/flysystem": "^1.0",
"php": "^7.2|^8.0",
"psr/http-message": "^1.0"
},
"require-dev": {
"mockery/mockery": "^1.3.3",
"phpunit/php-token-stream": "^3.1|^4.0",
"phpunit/phpunit": "^8.5|^9.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"autoload": {
"psr-4": {
"League\\Glide\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jonathan Reinink",
"email": "jonathan@reinink.ca",
"homepage": "http://reinink.ca"
}
],
"description": "Wonderfully easy on-demand image manipulation library with an HTTP based API.",
"homepage": "http://glide.thephpleague.com",
"keywords": [
"ImageMagick",
"editing",
"gd",
"image",
"imagick",
"league",
"manipulation",
"processing"
],
"support": {
"issues": "https://github.com/thephpleague/glide/issues",
"source": "https://github.com/thephpleague/glide/tree/1.7.0"
},
"time": "2020-11-05T17:34:03+00:00"
},
{ {
"name": "league/mime-type-detection", "name": "league/mime-type-detection",
"version": "1.5.1", "version": "1.5.1",
@ -6672,244 +6607,6 @@
], ],
"time": "2020-12-07T09:19:29+00:00" "time": "2020-12-07T09:19:29+00:00"
}, },
{
"name": "spatie/browsershot",
"version": "3.40.2",
"source": {
"type": "git",
"url": "https://github.com/spatie/browsershot.git",
"reference": "3e55eaf5ab8cee65d1661a567e89b3374afb9116"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/browsershot/zipball/3e55eaf5ab8cee65d1661a567e89b3374afb9116",
"reference": "3e55eaf5ab8cee65d1661a567e89b3374afb9116",
"shasum": ""
},
"require": {
"php": "^7.1",
"spatie/image": "^1.5.3",
"spatie/temporary-directory": "^1.1",
"symfony/process": "^4.2|^5.0"
},
"require-dev": {
"phpunit/phpunit": "^6.1|^7.5",
"spatie/phpunit-snapshot-assertions": "^1.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\Browsershot\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://github.com/freekmurze",
"role": "Developer"
}
],
"description": "Convert a webpage to an image or pdf using headless Chrome",
"homepage": "https://github.com/spatie/browsershot",
"keywords": [
"chrome",
"convert",
"headless",
"image",
"pdf",
"puppeteer",
"screenshot",
"webpage"
],
"support": {
"issues": "https://github.com/spatie/browsershot/issues",
"source": "https://github.com/spatie/browsershot/tree/3.40.2"
},
"funding": [
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2020-11-11T22:18:15+00:00"
},
{
"name": "spatie/image",
"version": "1.10.1",
"source": {
"type": "git",
"url": "https://github.com/spatie/image.git",
"reference": "6eaf45d61832c2396dd4b10cc81d9fce93a59e2d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/image/zipball/6eaf45d61832c2396dd4b10cc81d9fce93a59e2d",
"reference": "6eaf45d61832c2396dd4b10cc81d9fce93a59e2d",
"shasum": ""
},
"require": {
"ext-exif": "*",
"ext-mbstring": "*",
"league/glide": "^1.6",
"php": "^7.2|^8.0",
"spatie/image-optimizer": "^1.1",
"spatie/temporary-directory": "^1.0",
"symfony/process": "^3.0|^4.0|^5.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0|^9.0",
"symfony/var-dumper": "^4.0|^5.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\Image\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "Manipulate images with an expressive API",
"homepage": "https://github.com/spatie/image",
"keywords": [
"image",
"spatie"
],
"support": {
"issues": "https://github.com/spatie/image/issues",
"source": "https://github.com/spatie/image/tree/1.10.1"
},
"funding": [
{
"url": "https://spatie.be/open-source/support-us",
"type": "custom"
},
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2020-12-01T20:42:11+00:00"
},
{
"name": "spatie/image-optimizer",
"version": "1.3.2",
"source": {
"type": "git",
"url": "https://github.com/spatie/image-optimizer.git",
"reference": "6aa170eb292758553d332efee5e0c3977341080c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/image-optimizer/zipball/6aa170eb292758553d332efee5e0c3977341080c",
"reference": "6aa170eb292758553d332efee5e0c3977341080c",
"shasum": ""
},
"require": {
"ext-fileinfo": "*",
"php": "^7.2|^8.0",
"psr/log": "^1.0",
"symfony/process": "^4.2|^5.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0|^9.0",
"symfony/var-dumper": "^4.2|^5.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\ImageOptimizer\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "Easily optimize images using PHP",
"homepage": "https://github.com/spatie/image-optimizer",
"keywords": [
"image-optimizer",
"spatie"
],
"support": {
"issues": "https://github.com/spatie/image-optimizer/issues",
"source": "https://github.com/spatie/image-optimizer/tree/1.3.2"
},
"time": "2020-11-28T12:37:58+00:00"
},
{
"name": "spatie/temporary-directory",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/temporary-directory.git",
"reference": "f517729b3793bca58f847c5fd383ec16f03ffec6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/temporary-directory/zipball/f517729b3793bca58f847c5fd383ec16f03ffec6",
"reference": "f517729b3793bca58f847c5fd383ec16f03ffec6",
"shasum": ""
},
"require": {
"php": "^7.2|^8.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0|^9.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\TemporaryDirectory\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Alex Vanderbist",
"email": "alex@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "Easily create, use and destroy temporary directories",
"homepage": "https://github.com/spatie/temporary-directory",
"keywords": [
"php",
"spatie",
"temporary-directory"
],
"support": {
"issues": "https://github.com/spatie/temporary-directory/issues",
"source": "https://github.com/spatie/temporary-directory/tree/1.3.0"
},
"time": "2020-11-09T15:54:21+00:00"
},
{ {
"name": "stripe/stripe-php", "name": "stripe/stripe-php",
"version": "v7.67.0", "version": "v7.67.0",

View File

@ -10,7 +10,7 @@
*/ */
namespace Tests\Pdf; namespace Tests\Pdf;
use Spatie\Browsershot\Browsershot; use Beganovich\Snappdf\Snappdf;
use Tests\TestCase; use Tests\TestCase;
/** /**
@ -24,107 +24,14 @@ class PdfGenerationTest extends TestCase
parent::setUp(); parent::setUp();
} }
private function makePdf($header, $footer, $html, $pdf)
{
Browsershot::html($html)
->setNodeBinary(config('ninja.system.node_path'))
->setNpmBinary(config('ninja.system.npm_path'))
//->showBrowserHeaderAndFooter()
//->headerHtml($header)
//->footerHtml($footer)
->waitUntilNetworkIdle()
//->margins(10,10,10,10)
->noSandbox()
->savePdf($pdf);
}
public function testPdfGeneration() public function testPdfGeneration()
{ {
$html = file_get_contents(base_path().'/tests/Pdf/invoice.html'); $snappdf = new Snappdf();
$pdf = base_path().'/tests/Pdf/invoice.pdf';
$header = '<div style="font-size:14px;"<header></header>'; $pdf = $snappdf
->setHtml('<h1>Invoice Ninja</h1>')
->generate();
$footer = ' <div style="font-size:14px;"><footer> $this->assertNotNull($pdf);
<span class="pageNumber"></span> / <span class="totalPages"></span>
</footer></div>';
$this->makePdf($header, $footer, $html, $pdf);
$this->assertTrue(file_exists($pdf));
unlink($pdf);
}
public function testPdfGeneration2()
{
$html = file_get_contents(base_path().'/tests/Pdf/invoice2.html');
$pdf = base_path().'/tests/Pdf/invoice2.pdf';
$header = '<div style="font-size:14px;"<header></header>';
$footer = ' <div style="font-size:14px;"><footer>
<span class="pageNumber"></span> / <span class="totalPages"></span>
</footer></div>';
$this->makePdf($header, $footer, $html, $pdf);
$this->assertTrue(file_exists($pdf));
unlink($pdf);
}
public function testPdfGeneration3()
{
$html = file_get_contents(base_path().'/tests/Pdf/invoice3.html');
$pdf = base_path().'/tests/Pdf/invoice3.pdf';
$header = '<div style="font-size:14px;"<header></header>';
$footer = ' <div style="font-size:14px;"><footer>
<span class="pageNumber"></span> / <span class="totalPages"></span>
</footer></div>';
$this->makePdf($header, $footer, $html, $pdf);
$this->assertTrue(file_exists($pdf));
unlink($pdf);
}
public function testPdfGeneration4()
{
$html = file_get_contents(base_path().'/tests/Pdf/invoice4.html');
$pdf = base_path().'/tests/Pdf/invoice4.pdf';
$header = '<div style="font-size:14px;"<header></header>';
$footer = ' <div style="font-size:14px;"><footer>
<span class="pageNumber"></span> / <span class="totalPages"></span>
</footer></div>';
$this->makePdf($header, $footer, $html, $pdf);
$this->assertTrue(file_exists($pdf));
unlink($pdf);
}
public function testPdfGeneration5()
{
$html = file_get_contents(base_path().'/tests/Pdf/invoice5.html');
$pdf = base_path().'/tests/Pdf/invoice5.pdf';
$header = '<div style="font-size:14px;"<header></header>';
$footer = ' <div style="font-size:14px;"><footer>
<span class="pageNumber"></span> / <span class="totalPages"></span>
</footer></div>';
$this->makePdf($header, $footer, $html, $pdf);
$this->assertTrue(file_exists($pdf));
unlink($pdf);
} }
} }