PHP Fatal error: Declaration of Mpdf\Mpdf::setLogger(Psr\Log\LoggerInterface $logger) must be compatible with Psr\Log\LoggerAwareInterface::setLogger(Psr\Log\LoggerInterface $logger)
s1k3 opened this issue · 3 comments
s1k3 commented
Describe the bug
PHP Fatal error: Declaration of Mpdf\Mpdf::setLogger(Psr\Log\LoggerInterface $logger) must be compatible with Psr\Log\LoggerAwareInterface::setLogger(Psr\Log\LoggerInterface $logger): void in /home/robin/Projects/test/vendor/mpdf/mpdf/src/Mpdf.php on line 1569
To Reproduce
Use
- Laravel 9**
- php 8.1.3
- "niklasravnsborg/laravel-pdf": "^4.1"
Code Used to Render Pdf
<?php
use Illuminate\Support\Facades\Route;
Route::get('/', function () {
$pdf = PDF::loadView('welcome', []);
return $pdf->stream('document.pdf');
});
HTML used
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<p>This is test</p>
</body>
</html>
mr-ghomi commented
I have this problem too
mr-ghomi commented
My problem was solved this way
- composer remove niklasravnsborg/laravel-pdf
- composer remove mpdf/mpdf
- composer remove psr/log
- composer require psr/log=v2.*
- composer require mpdf/mpdf v8.0.17
- composer require niklasravnsborg/laravel-pdf