DEV Community

AutoIdle
AutoIdle

Posted on • Originally published at Medium on

Use Heroku environment variables in your Laravel app

Laravel on Heroku — Tip #1

On Heroku, you get environment variables for PostgreSQL, Redis, e.g.

You shouldn't add manually environment variables on Heroku for Database (like DB_HOST, DB_PORT, e.g.) and Redis (REDIS_HOST, e.g.).

Because you have to change these if you upgrade/downgrade these Heroku add-ons.

And more importantly, Heroku can change these environment variables at any time.

A better solution would be, add the following lines at the beginning of config/database.php

Want more tips like these?

You should follow me on Twitter! And if you’re building on Heroku, you should check out AutoIdle — the automated way to save money on your staging and review apps.

Top comments (0)