title: What is the best way to save config variables in a PHP web app?
body: <p>I often switch between .NET and PHP development. With <strong>ASP.NET sites</strong> I save configuration information (e.g. connection strings, directories, application setting) in the <strong>web.config</strong> file which is appropriately protected and easy to access the values, etc.</p>
  
  <p>In <strong>PHP</strong>, I solve this with a <strong>class that has static methods</strong> for each variable:</p>
  
  <pre><code>class webconfig {
      public static function defaultPageIdCode() {
          return 'welcome';
      }
  }
  </code></pre>
  
  <p>The file is <strong>included</strong> by the app variables are accessed with a one-line:</p>
  
  <pre><code>$dp = webconfig::defaultPageIdCode();
  </code></pre>
  
  <p>And since PHP isn't compiled, it is easy to <strong>telnet</strong> in and change a value for a website anyway, so this solution <strong>works fairly well</strong> and gives me these <strong>two advantages</strong>:</p>
  
  <ul>
  <li>I can <strong>add logic</strong> to a config variable without breaking its interface with the application</li>
  <li>these config variables appear as <strong>intellisense</strong> in my e.g. Eclipse, NetBeans, etc.</li>
  </ul>
  
  <p>But I can imagine there are other ways people solve saving web config settings in PHP which may have other advantages.</p>
  
  <p><strong>Especially those who have experience with a number of PHP frameworks, what are other ways of saving config variables and their advantages and disadvantages?</strong></p>