I use docker. Pretty much just copy/paste this docker-compose file into every new project which gives me a PHP/Apache server and an SMTP server for testing emails in a single command:
docker-compose up
Just a small note in case someone else is attempting to re-create this setup: when you create the docker-compose file, make sure it has a .yml or .yaml file extension.