NotionCommotion Posted December 3, 2016 Share Posted December 3, 2016 Seems a lot like a global variable, I always hear people saying how evil globals are. Quote Link to comment Share on other sites More sharing options...
benanamen Posted December 3, 2016 Share Posted December 3, 2016 Laravel uses it. Quote Link to comment Share on other sites More sharing options...
requinix Posted December 3, 2016 Share Posted December 3, 2016 Reading values from global variables is fine. Writing values is where the complications are, because it's not always easy to tell where a value comes from. If you only write in a small number of places (ideally one) then there's no problem. Put another way, don't just repeat what you hear without knowing why. Quote Link to comment Share on other sites More sharing options...
NotionCommotion Posted December 3, 2016 Author Share Posted December 3, 2016 Put another way, don't just repeat what you hear without knowing why. Never said they were evil, just that I have heard others say so. I've gone back and forth trying to form my own opinion. I've heard arguments against using them as it is more difficult to unit test. I've currently never really gotten into unit testing, so I don't have an opinion. Thoughts? Also, I don't have a reason to think so, but expect it would not be a good idea to initially set a database connection to a global or use dotenv. Thoughts? Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.