Re: [PEPr] Comment on Configuration::Config_Lite
| From: | Patrick E. | Date: | Sun, 02 Jan 2011 20:21:26 +0000 |
| Subject: | Re: [PEPr] Comment on Configuration::Config_Lite | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-53929@lists.php.net to get a copy of this message | ||
Hej,
thanks for the feedback.
> On Fri, Dec 31, 2010 at 12:05 PM, Christian Weiske <cweiske@php.net> wrote:
> Introduce a "Config/" folder that contains Lite.php in your git repo. This
> makes unit testing easier.
done in master branch.
> The ini file has a <?php exit; ?> in it.
Only if you have set a filename with php as suffix,
that is a simple and common (eg., doku wiki uses this technique, too)
way to prevent viewing configuration files under the document root.
This works for every (also the simplest) web server.
> - "exit" stops the whole application. If you want to prevent inclusion of
I don't think it makes much difference to get an possible ERROR or
unwanted output by including or evaluating a configuration file or
just exit/return.
> the ini file in php, you should just use return;
thanks, "return" sounds better, edited in master branch.
> There should be a way to set key/value pairs without a section, i.e. by
> using a null/empty section name.
I think about the implementation, get(null, 'key') feels not comfortable to me.
> You could use file_put_contents() instead of fopen&&fwrite&&fclose.
The exception handling seemed easier and clearer to me.
> How do you handle multi line values?
> Config also supports comments in ini files, which is a good thing.
multi line values and comments are not supported by the underlying
zend_parse_ini function.
What i wanted to "solve" with Config_Lite is a simple and fast way,
writing an own Parser in Userland (like Config) is not my intention
and would result in an application much slower.
> Really nifty would be Config_Lite implementing ArrayObject - so that
> reading/setting config values would be as easy as $config['section']['foo']
> = 'bar'.
I implemented ArrayAccess in trunk,
but i take a look at ArrayObject.
> The Config package supports directives (keys) like "foo[]=bar" or
> "foo[bar]=baz", opening an array. Maybe Config_Lite should support that,
> too.
yes, i added this in master branch and btw. patches are welcome :)
--
best Regards,
Patrick
--
http://pear.php.net/pepr/pepr-proposal-show.php?id=645