I often switch between .NET and PHP development. With ASP.NET sites I save configuration information (e.g. connection strings, directories, application setting) in the web.config file which is appropriately protected and easy to access the values, etc.In PHP, I solve this with a class that has static methods for each variable:\[code\]class webconfig { public static function defaultPageIdCode() { return 'welcome'; }}\[/code\]The file is included by the app variables are accessed with a one-line:\[code\]$dp = webconfig::defaultPageIdCode();\[/code\]And since PHP isn't compiled, it is easy to telnet in and change a value for a website anyway, so this solution works fairly well and gives me these two advantages:
- I can add logic to a config variable without breaking its interface with the application
- these config variables appear as intellisense in my e.g. Eclipse, NetBeans, etc.