Laravel 9 does not support installing mpdf
P粉738676186
P粉738676186 2023-12-23 17:04:04
0
1
425

I'm using laravel 9 and my PhP version is 8.0.2 and I'm trying to install the Mpdf package, so I wrote the following command

composer require mpdf/mpdf

but I get this error Question 1

- mpdf/mpdf[v8.1.0, ..., v8.1.2] require psr/log ^1.0 || ^2.0 -> found psr/log[1.0.0, ..., 1.1.4, 2.0.0] but the package is fixed to 3.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - Root composer.json requires mpdf/mpdf ^8.1 -> satisfiable by mpdf/mpdf[v8.1.0, v8.1.1, v8.1.2].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

I tried removing the vendor and composer.lock and updating with composer and it did work

P粉738676186
P粉738676186

reply all(1)
P粉864594965

mPDF is not compatible with psr/log 3.x because it supports older PHP versions (without return type hints). A previous installation of Laravel will force the psr/log library to be converted to the 3.x version.

You can use the flags --with-all-dependencies and composer require mpdf/mpdf to automatically downgrade dependencies.

Alternatively, downgrade the psr/log library to 2.x - just add or change the "psr/log": "^2.0" line in your Composer. json file and run composer update. This will solve the problem.

Or you can ask for mPDF first and then ask for Laravel, which should work too. Or require them both in one command.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!