Shady Hesham's avatar

mpdf can not be installed in laravel 9

0

i am using laravel 9 and my PhP version is 8.0.2, and I am trying to install Mpdf package, so I write the following command

composer require mpdf/mpdf but I get this error Problem

- 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 have tried to delete the vendor and composer.lock and use composer update and it does work

0 likes
7 replies
Shady Hesham's avatar

{ "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": [] } }, "config": { "optimize-autoloader": true, "preferred-install": "dist", "sort-packages": true }, "minimum-stability": "dev", "prefer-stable": true }

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

Ok try composer require psr/log ^2.0

Then try installing again

2 likes
Sinnbeck's avatar

Or delete vendor folder and composer.lock, and try installing it

1 like
Sinnbeck's avatar

@Shady Hesham great. Please set the thread as solved by marking a best answer

1 like
yeaung's avatar

I have an error Array and string offset access syntax with curly braces is no longer supported. I'm using laravel 10.10, php version 8.1 and mpdf 7. Please let me know how to solve this error

Please or to participate in this conversation.