Install phpspreadsheet on old version of Mac

I’m running PHP version 7.3.29 on Mac and need to install PhpSpreadsheet but get errors

phpoffice/phpspreadsheet 1.18.0 requires ext-zip * -> it is missing
from your system. Install or enable PHP’s zip extension.

and

phpoffice/phpspreadsheet[1.26.0, …, 1.29.10] require php ^7.4 ||
^8.0 -> your php version (7.3.29) does not satisfy that requirement.

Update : I’m using local running PHP version 8.1.23. I need the correct way to install PHP extensions in Local by Flywheel on macOS.

Cannot install phpspreadsheet and cannot download Excel spreadsheets in .xlsx) format. I have tried updating PHP and installing an older version pf php spreadsheet but nothing works.

So the core problem is that the PHP zip extension is missing from my system, which is preventing PhpSpreadsheet from being installed.

I cannot install the PHP zip extension on my machine