← All lessons

Lessons: #secrets

4 min read

Keeping Secrets Out of Git: .env, APP_KEY and APP_DEBUG

Laravel's documentation says the .env file should not be committed to source control. Keep APP_KEY and database credentials in the environment, set APP_DEBUG to false in production, and after config:cache only call env() from config files. If you need a file in git, use php artisan env:encrypt and store the decryption key in a password manager.

Get new briefs by email

Short alerts when a PHP or WordPress vulnerability needs action.

Double opt-in via Buttondown; unsubscribe any time. See our privacy policy.