Member-only story
How to Override Laravel Installer to Allow Custom .env Defaults and Run Extra Shell Commands
3 min readMar 11, 2021
I can’t state how many times I have an idea for a side project. Start it, and scrap it. A lot of that is my ADHD, but one thing that I hate about Laravel’s installer and boilerplate is I ALWAYS have to edit the .env.
There’s a few things though that never change from project to project.
Here are my generally sensible defaults for most laravel projects:
Change App Name / Url
APP_NAME=Awesomeapp
APP_URL=http://awesomeapp.test
Mailhog for email testing.
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=admin@awesomeapp.test
MAIL_PASSWORD=test1234
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=admin@awesomeapp.test
MAIL_FROM_NAME=Awesomeapp
Setup redis for sessions/cache/queue.
CACHE_DRIVER=redis
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis
SESSION_LIFETIME=120REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
Running extra scripts.
I always run a script that creates a symlink from ~/sites/appname ~…