i am using mpdf laravel (carlos-meneses/laravel-mpdf) package but when I run the pdf i get the following error
Declaration of MpdfMpdf::setLogger(PsrLogLoggerInterface $logger) must be compatible with PsrLogLoggerAwareInterface::setLogger(PsrLogLoggerInterface $logger): void
I have tried to change psr/log to "^1.1 || ^2.0" in composer.lock because when I install the package mpdf it requires it. but it does not work and here is my composer.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.0.2",
"anhskohbo/no-captcha": "^3.4",
"carlos-meneses/laravel-mpdf": "^2.1",
"guzzlehttp/guzzle": "^7.2",
"intervention/image": "^2.7",
"laravel/framework": "^9.19",
"laravel/sanctum": "^2.14.1",
"laravel/tinker": "^2.7",
"mcamara/laravel-localization": "^1.7",
"spatie/laravel-permission": "^5.5"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/breeze": "^1.11",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^1.0"
},
"autoload": {
"psr-4": {
"App\": "app/",
"Database\Factories\": "database/factories/",
"Database\Seeders\": "database/seeders/"
},
"files": [
"app/Helpers/helper.php"
]
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r "file_exists('.env') || copy('.env.example', '.env');""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
}
2
Answers
It is the fault of the wrapper library that it lets you install incompatible versions of dependencies. As Nico Haase mentions in a comment above, the issue has already been mitigated in the library.
On a side note, you never alter the composer.lock file manually. Changes made will be overwritten with the next
composer install
call. You need to forcepsr/log
to version 2.x in your composer.json file, as answered in your previous question.after install package .
then go to your composer.json
"require": {
}
then run composer update. thenn booo its’s done
or follow this link Instruction
https://arif98741.medium.com/generate-bangla-text-content-in-pdf-using-laravel-1f786b4d1362