Support the ongoing development of Laravel.io →
Configuration Architecture
Last updated 2 years ago.
0

I would just use if statements checking what environment it is, but I think you should probably look at fixing your dev environment rather than coding it into the site.

0

I use .env and .env.local files for working locally. However, be aware that if you have debugging turned on your deployment server that it will show your database information and such if that information is in your .env files.

I also use git to work across 3 different machines.

Regarding the difference between dev code and deploy code, if you use the .env file you could do something like;

if ( $_ENV['APP_TYPE'] == 'dev' ) {

I don't know if this is a best of practice type of thing but it works for since I'm using the same code base across 3 different projects at the moment. i do plan to separate out each code base eventually but it helps me to deal with code that is basically the same across all of them like HTML layouts and such.

My .env file looks like this;

<?php
return array(
	'APP_TYPE'			=> 'dev'
);
Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

ajoslin103 ajoslin103 Joined 11 Jan 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.