<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:series="http://unfoldingneurons.com/"
		>
<channel>
	<title>Comments on: Custom Apps: Some Strategies For Easy Configuration Files</title>
	<atom:link href="http://www.brandonsavage.net/custom-apps-some-strategies-for-easy-configuration-files/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brandonsavage.net/custom-apps-some-strategies-for-easy-configuration-files/</link>
	<description>The personal blog of Brandon Savage. Contains entries of a personal and professional nature focusing on PHP, Apple, LAMP, MySQL and Washington, DC.</description>
	<lastBuildDate>Fri, 12 Mar 2010 06:12:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: JasonDavis</title>
		<link>http://www.brandonsavage.net/custom-apps-some-strategies-for-easy-configuration-files/#comment-2910</link>
		<dc:creator>JasonDavis</dc:creator>
		<pubDate>Tue, 26 Jan 2010 23:48:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=661#comment-2910</guid>
		<description>I would like to add to the users who recommend using YAML, I do&#039;t have the link but I have read a couple benchmark test based on using pure PHP, ini file, json file, xml file, and YAML file and YAML came in last place for performamce.  Where ini was number 2.  I beleive the test showed the ini file to do around 3,000 reads per seconds and the YAML file was around 400 just to give you an idea of how much slower it is.</description>
		<content:encoded><![CDATA[<p>I would like to add to the users who recommend using YAML, I do&#8217;t have the link but I have read a couple benchmark test based on using pure PHP, ini file, json file, xml file, and YAML file and YAML came in last place for performamce.  Where ini was number 2.  I beleive the test showed the ini file to do around 3,000 reads per seconds and the YAML file was around 400 just to give you an idea of how much slower it is.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Dickey</title>
		<link>http://www.brandonsavage.net/custom-apps-some-strategies-for-easy-configuration-files/#comment-2422</link>
		<dc:creator>Jeff Dickey</dc:creator>
		<pubDate>Tue, 01 Dec 2009 05:14:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=661#comment-2422</guid>
		<description>I haven&#039;t written new code using INI files in years... up until early 2008, I had a set of configuration classes whose data storage format was XML; that allowed me to express arbitrary types and nesting in a portable manner. That has been almost completely superseded by YAML and Spyc, which give me the flexibility I need with a much more terse, human-readable data format. If you have a need for persisting configuration or other such information, you should at least poke around with it.

http://spyc.sourceforge.net
http://www.yaml.org/
http://en.wikipedia.org/wiki/YAML</description>
		<content:encoded><![CDATA[<p>I haven&#8217;t written new code using INI files in years&#8230; up until early 2008, I had a set of configuration classes whose data storage format was XML; that allowed me to express arbitrary types and nesting in a portable manner. That has been almost completely superseded by YAML and Spyc, which give me the flexibility I need with a much more terse, human-readable data format. If you have a need for persisting configuration or other such information, you should at least poke around with it.</p>
<p><a href="http://spyc.sourceforge.net" rel="nofollow">http://spyc.sourceforge.net</a><br />
<a href="http://www.yaml.org/" rel="nofollow">http://www.yaml.org/</a><br />
<a href="http://en.wikipedia.org/wiki/YAML" rel="nofollow">http://en.wikipedia.org/wiki/YAML</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Voyteck</title>
		<link>http://www.brandonsavage.net/custom-apps-some-strategies-for-easy-configuration-files/#comment-1223</link>
		<dc:creator>Voyteck</dc:creator>
		<pubDate>Sat, 19 Sep 2009 21:41:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=661#comment-1223</guid>
		<description>Nice article - but quite easy one. Once you have more sophisticated needs, the topics showed are not enough.
Just wanted to add some three pennies with my article:
http://linkedphpers.blogspot.com/2009/04/webapplications-part-2-standard.html
You can find there several additional ways of storing and managing system configuration...</description>
		<content:encoded><![CDATA[<p>Nice article &#8211; but quite easy one. Once you have more sophisticated needs, the topics showed are not enough.<br />
Just wanted to add some three pennies with my article:<br />
<a href="http://linkedphpers.blogspot.com/2009/04/webapplications-part-2-standard.html" rel="nofollow">http://linkedphpers.blogspot.com/2009/04/webapplications-part-2-standard.html</a><br />
You can find there several additional ways of storing and managing system configuration&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Sinclair</title>
		<link>http://www.brandonsavage.net/custom-apps-some-strategies-for-easy-configuration-files/#comment-1190</link>
		<dc:creator>Michael Sinclair</dc:creator>
		<pubDate>Thu, 17 Sep 2009 16:09:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=661#comment-1190</guid>
		<description>Just be sure that if you use an INI file that you keep your INI file in a non-public directory, and protect it with htaccess or some other method.</description>
		<content:encoded><![CDATA[<p>Just be sure that if you use an INI file that you keep your INI file in a non-public directory, and protect it with htaccess or some other method.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zilvinas</title>
		<link>http://www.brandonsavage.net/custom-apps-some-strategies-for-easy-configuration-files/#comment-1189</link>
		<dc:creator>Zilvinas</dc:creator>
		<pubDate>Thu, 17 Sep 2009 13:22:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=661#comment-1189</guid>
		<description>If you *CAN* allways pass or inject using DI the configuration object fully or partially to objects that require it. Constants, class constants, static class access is the same as using global state. And global state is not a very heatlhy way of living. More on this:

http://misko.hevery.com/code-reviewers-guide/flaw-brittle-global-state-singletons/

XML was not created for human beings to read so if you are not using *TOOLS* to modify your configuration do not use XML. There is no reason to. Where INI has limitations YAML doesn&#039;t. Which is extremely readable and very powerful. Or best if only developers will be changing the configuration it may be as well left as a PHP array which allows to have dynamic values.</description>
		<content:encoded><![CDATA[<p>If you *CAN* allways pass or inject using DI the configuration object fully or partially to objects that require it. Constants, class constants, static class access is the same as using global state. And global state is not a very heatlhy way of living. More on this:</p>
<p><a href="http://misko.hevery.com/code-reviewers-guide/flaw-brittle-global-state-singletons/" rel="nofollow">http://misko.hevery.com/code-reviewers-guide/flaw-brittle-global-state-singletons/</a></p>
<p>XML was not created for human beings to read so if you are not using *TOOLS* to modify your configuration do not use XML. There is no reason to. Where INI has limitations YAML doesn&#8217;t. Which is extremely readable and very powerful. Or best if only developers will be changing the configuration it may be as well left as a PHP array which allows to have dynamic values.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hervé</title>
		<link>http://www.brandonsavage.net/custom-apps-some-strategies-for-easy-configuration-files/#comment-1174</link>
		<dc:creator>Hervé</dc:creator>
		<pubDate>Wed, 16 Sep 2009 16:41:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=661#comment-1174</guid>
		<description>You forgotten json (stored in files) which is also a good way to keep parameters</description>
		<content:encoded><![CDATA[<p>You forgotten json (stored in files) which is also a good way to keep parameters</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alan Pinstein</title>
		<link>http://www.brandonsavage.net/custom-apps-some-strategies-for-easy-configuration-files/#comment-1172</link>
		<dc:creator>Alan Pinstein</dc:creator>
		<pubDate>Wed, 16 Sep 2009 14:11:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=661#comment-1172</guid>
		<description>Nice post! 

I just had to deal with a similar, but different problem, of managing *multiple* config files for projects. When all project components aren&#039;t in your control, or even all in the same language, config files proliferate and updating them to work properly on different environments is a painful process.

I wrote and open-sourced an app called config-magic that lets you easily manage multiple config files from a single &quot;profile&quot; config, thus allowing you to regenerate N config files for any box with a single command. You can store multiple profiles and thus easily re-configure any project checkout to target any environment in a matter of seconds.

Check it out: http://github.com/apinstein/config-magic</description>
		<content:encoded><![CDATA[<p>Nice post! </p>
<p>I just had to deal with a similar, but different problem, of managing *multiple* config files for projects. When all project components aren&#8217;t in your control, or even all in the same language, config files proliferate and updating them to work properly on different environments is a painful process.</p>
<p>I wrote and open-sourced an app called config-magic that lets you easily manage multiple config files from a single &#8220;profile&#8221; config, thus allowing you to regenerate N config files for any box with a single command. You can store multiple profiles and thus easily re-configure any project checkout to target any environment in a matter of seconds.</p>
<p>Check it out: <a href="http://github.com/apinstein/config-magic" rel="nofollow">http://github.com/apinstein/config-magic</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: roy simkes</title>
		<link>http://www.brandonsavage.net/custom-apps-some-strategies-for-easy-configuration-files/#comment-1165</link>
		<dc:creator>roy simkes</dc:creator>
		<pubDate>Wed, 16 Sep 2009 08:39:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=661#comment-1165</guid>
		<description>You might want to check out Zend Framework&#039;s Zend_Config_Ini class for ini parsing too with some simple differences.

http://framework.zend.com/manual/en/zend.config.adapters.ini.html

What it does is basically the same as parse_ini_file, however it gives you the benefit to get deeper than 3rd level. By something like this:

webhost                  = www.example.com
database.adapter         = pdo_mysql
database.params.host     = db.example.com
database.params.username = dbuser

you can reach the username parameter by something like this:

$config = new Zend_Config_Ini(&#039;config.ini&#039;);
echo $config-&gt;databaser-&gt;params-&gt;username;


You can also define different configuration options for different environments like production and testing.</description>
		<content:encoded><![CDATA[<p>You might want to check out Zend Framework&#8217;s Zend_Config_Ini class for ini parsing too with some simple differences.</p>
<p><a href="http://framework.zend.com/manual/en/zend.config.adapters.ini.html" rel="nofollow">http://framework.zend.com/manual/en/zend.config.adapters.ini.html</a></p>
<p>What it does is basically the same as parse_ini_file, however it gives you the benefit to get deeper than 3rd level. By something like this:</p>
<p>webhost                  = <a href="http://www.example.com" rel="nofollow">http://www.example.com</a><br />
database.adapter         = pdo_mysql<br />
database.params.host     = db.example.com<br />
database.params.username = dbuser</p>
<p>you can reach the username parameter by something like this:</p>
<p>$config = new Zend_Config_Ini(&#8216;config.ini&#8217;);<br />
echo $config-&gt;databaser-&gt;params-&gt;username;</p>
<p>You can also define different configuration options for different environments like production and testing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://www.brandonsavage.net/custom-apps-some-strategies-for-easy-configuration-files/#comment-1164</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Wed, 16 Sep 2009 08:03:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=661#comment-1164</guid>
		<description>Great post, thanks Brandon. I agree, if all your developers are comfortable with PHP then PHP for config files can be viable solution. An alternative to using default constructor arguments is to use named constructors. Static methods that clearly describe how the object is going to be created.

public static function createFromDefaultConfig()
{
  return self::createFromConfig(Config::getInstance());
}

public static function createFromConfig(Config $config)
{
  return new self($config-&gt;get(&#039;db:username&#039;)...);
}</description>
		<content:encoded><![CDATA[<p>Great post, thanks Brandon. I agree, if all your developers are comfortable with PHP then PHP for config files can be viable solution. An alternative to using default constructor arguments is to use named constructors. Static methods that clearly describe how the object is going to be created.</p>
<p>public static function createFromDefaultConfig()<br />
{<br />
  return self::createFromConfig(Config::getInstance());<br />
}</p>
<p>public static function createFromConfig(Config $config)<br />
{<br />
  return new self($config-&gt;get(&#8216;db:username&#8217;)&#8230;);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jiri Fornous</title>
		<link>http://www.brandonsavage.net/custom-apps-some-strategies-for-easy-configuration-files/#comment-1163</link>
		<dc:creator>Jiri Fornous</dc:creator>
		<pubDate>Wed, 16 Sep 2009 07:35:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=661#comment-1163</guid>
		<description>define constants 
- has a potential problem with namespaces and autoload in Php 5.3 
- wouldn&#039;t recommend for configuration

class constants 
- has disadvantage of only simple types - no string concat, no function assign, is final 
- wouldn&#039;t recommend for configuration

ini or xml file 
- unless you cache the file in cache (APC, Memcache) it&#039;s slow solution because of everytime disc usage 
- would recommend only with cache

class properties 
- using magic __get method with main switch of (hash map for speed) defined properties is good solution. It works well with namespaces, no additional cache handling necessary when using opcode cache, easy for autoload, you may decide whether accept or deny value change using __set magic method. 
- would recommend</description>
		<content:encoded><![CDATA[<p>define constants<br />
- has a potential problem with namespaces and autoload in Php 5.3<br />
- wouldn&#8217;t recommend for configuration</p>
<p>class constants<br />
- has disadvantage of only simple types &#8211; no string concat, no function assign, is final<br />
- wouldn&#8217;t recommend for configuration</p>
<p>ini or xml file<br />
- unless you cache the file in cache (APC, Memcache) it&#8217;s slow solution because of everytime disc usage<br />
- would recommend only with cache</p>
<p>class properties<br />
- using magic __get method with main switch of (hash map for speed) defined properties is good solution. It works well with namespaces, no additional cache handling necessary when using opcode cache, easy for autoload, you may decide whether accept or deny value change using __set magic method.<br />
- would recommend</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Samuel Folkes</title>
		<link>http://www.brandonsavage.net/custom-apps-some-strategies-for-easy-configuration-files/#comment-1162</link>
		<dc:creator>Samuel Folkes</dc:creator>
		<pubDate>Wed, 16 Sep 2009 05:58:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=661#comment-1162</guid>
		<description>Informative article Brandon. This is a topic that I gave a lot of thought once I made the switch to OOP and realized that using &lt;code&gt;define()&lt;/code&gt; to set up configuration constants wasn&#039;t always a viable option. An alternative method to avoid the caveats of using INI files if you don&#039;t mind sacrificing a bit of readability is to use an XML configuration file in tandem with the SimpleXML extension. Its a very flexible solution that has the added advantage that most PHP developers are somewhat familiar with XML.</description>
		<content:encoded><![CDATA[<p>Informative article Brandon. This is a topic that I gave a lot of thought once I made the switch to OOP and realized that using <code>define()</code> to set up configuration constants wasn&#8217;t always a viable option. An alternative method to avoid the caveats of using INI files if you don&#8217;t mind sacrificing a bit of readability is to use an XML configuration file in tandem with the SimpleXML extension. Its a very flexible solution that has the added advantage that most PHP developers are somewhat familiar with XML.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
