Skip to content

Commit 3ec918c

Browse files
committed
Allow self signed certificates on development environment
1 parent 41e2210 commit 3ec918c

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

classes/PDFWrapper.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ public function loadTemplate($code, $data = [], $encoding = null)
4545
$this->setPaper($template->size, $template->orientation ?? 'portrait');
4646
}
4747

48+
$this->allowSelfSignedCertificates();
49+
4850
return $this;
4951
}
5052

@@ -55,6 +57,8 @@ public function loadLayout($code, $data = [], $encoding = null)
5557
$encoding
5658
);
5759

60+
$this->allowSelfSignedCertificates();
61+
5862
return $this;
5963
}
6064

@@ -99,4 +103,21 @@ protected function parseMarkup($markup, $data)
99103
return Twig::parse($markup, $data);
100104
}
101105
}
106+
107+
protected function allowSelfSignedCertificates()
108+
{
109+
if (app()->environment('production')) {
110+
return;
111+
}
112+
113+
$context = stream_context_create([
114+
'ssl' => [
115+
'verify_peer' => false,
116+
'verify_peer_name' => false,
117+
'allow_self_signed' => true,
118+
],
119+
]);
120+
121+
$this->dompdf->setHttpContext($context);
122+
}
102123
}

updates/version.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,4 @@ v7.0.0: Update to Laravel Dompdf v2.0.
5151
v7.0.1: Fix page numbers demo.
5252
v7.1.0: Fix creating public directory.
5353
v7.1.1: Minor fix.
54+
v7.1.2: Allow self signed certificates on development environment.

0 commit comments

Comments
 (0)