1

I get the following error when I want to do a composer update:

Your requirements could not be resolved to an installable set of packages.

Problem 1 - dompdf/dompdf[v0.8.5, ..., v0.8.6] require php ^7.1 -> your php version (8.0.25) does not satisfy that requirement. - Root composer.json requires dompdf/dompdf ^0.8.5 -> satisfiable by dompdf/dompdf[v0.8.5, v0.8.6].

What can I do?

I try composer require dompdf/dompdf:^2.1

and then come this Problem: enter image description here

This is my composer.json

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.2.5||^8.0",
        "fideloper/proxy": "^4.2",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^7.0.1",
        "laravel/framework": "^8.0",
        "laravel/tinker": "^2.0",
        "laravel/ui": "^3.0",
        "livewire/livewire": "^1.2",
        "maatwebsite/excel": "^3.1",
        "rachidlaasri/laravel-installer": "^4.1",
        "spatie/laravel-mix-preload": "^1.1",
        "spatie/laravel-query-builder": "^2.8"
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^3.3",
        "barryvdh/laravel-ide-helper": "^2.7",
        "facade/ignition": "^2.3.6",
        "fzaninotto/faker": "^1.9.1",
        "laravel-shift/blueprint": "^1.13",
        "mockery/mockery": "^1.3.1",
        "nunomaduro/collision": "^5.0",
        "phpunit/phpunit": "^9.0"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "platform-check": false
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi",
            "@php artisan ide-helper:generate"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    }
}

Thank you all for your help

Michael
  • 235
  • 1
  • 8

1 Answers1

-1

First of all there is no dompdf:2.1

you should change your command:

composer require dompdf/dompdf:^2.0.1

Even you can use version 2.0.3 which is latest at current time!

Then delete the composer.lock file in your project root and try again to see if problem goes away.

If not, you should check all other packages versions to support PHP8.0

First, make sure you're at the latest version of Laravel 6, 7 or 8 to get PHP 8 support. Then make sure you're on the very latest version of any first-party package from Laravel like Passport, Cashier, Dusk, etc.

There are also a couple of commonly used dependencies you'll need to update in your composer.json file:

  • PHP to php:^8.0
  • Faker to fakerphp/faker:^1.9.1
  • PHPUnit to phpunit/phpunit:^9.3

Finally, run composer update to update other packages. Make sure to test your application before updating production. That's it! Enjoy PHP 8!

Read laravel blog about it

Alijvhr
  • 1,695
  • 1
  • 3
  • 22
  • Changing the requirement won't resolve the problems about the wrong PHP version being used – Nico Haase Mar 10 '23 at 11:02
  • First problem is the version he wants. doesn't exist at all! so you have to change the version to real version! – Alijvhr Mar 10 '23 at 11:15
  • Then I said to remove `composer.lock` to update packages for supporting PHP8.0. read the last line. there is a documentation – Alijvhr Mar 10 '23 at 11:17
  • Removing composer.lock should be the last option, as this would also result in other dependencies being upgraded – Nico Haase Mar 10 '23 at 11:22
  • Other dependencies are all laravel dependencies! and it's in laravel blog: doing that for adding support for php8 – Alijvhr Mar 10 '23 at 11:23