This is a sample app to implement CSV/TSV download feature with CakePHP4. (it can be implemented in the same way in CakePHP3 as well)
More detailed is here: CakePHPでCSV/TSVダウンロード機能を実装する🥮 - Fusic Tech Blog
cp .env.example .env; vim .env
docker compose up -d
# Install php dependencies
docker compose exec web composer install
Visit http://localhost/pages/demo
Can be found here ./sample_files