While updating composer or installing a new package, we often get stuck with this –

./composer.json has been updated
Running composer update zircote/swagger-php
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - mpdf/mpdf is locked to version v8.1.3 and an update of this package was not requested.
    - mpdf/mpdf v8.1.3 requires php ^5.6 || ^7.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 -> your php version (8.4.1) does not satisfy that requirement.

To get over this just trying to fully update these packages (like mpdf) here with all dependencies –

composer update mpdf/mpdf --with-all-dependencies

If the packages are not dead and still maintain to match php version, you will be able to get the latest version updated to match your current php version.