Hello,
If Amazon Linux 2 or any other distribution don't include the php-tidy package for PHP8 (maybe Amazon will add it in the near future, maybe you can contact them about this missing package), we recommend using an external repository (or compile and use PHP from source).
In the case of Amazon Linux 2 you can use Remi's repository (https://rpms.remirepo.net/). Please check the following documentation, that install PHP 8, including Tidy on Amazon Linux 2:
https://techviewleo.com/install-php-8-on-amazon-linux/
Also please note that HTML methods included in phpdocx have the following option: forceNotTidy . Although using PHP Tidy is recommended, this option can be used when Tidy can't be installed. Using this option requires adding a correct HTML/CSS to be transformed, if PHP Tidy is not available the HTML/CSS can't be cleaned/repaired automatically.
Regards.