I started work today on Xsettings for Kohana PHP framework.

I like the Kohana config method (in terms of file layout) but I always like to have the option to store settings in a database as well. My reasoning behind this is that it is easier to edit and update settings stored in this way via an admin backend.

Xsetting is my solution: it works in a very similar way to the normal file based config (in fact you still need a file initially!). So for example you will be able to call Xsettings::item("config.this.that") and Xsettings::set("config.set","a value"). Cleverly (hehe) I will be defaulting back to the normal Kohana file based cfg if a setting can't be found in the database.

The idea of this is aimed at installable applications - the idea being you can define a configuration file in the normal way BUT then load the values into a database (probably with something like Xsettings::set("group") - i.e. with no value to be set) when the user initially installs the application. Of course on single use projects / sites it is also useful and you dont need a file to set up with them either as you would be manually adding the data to the table.

On top of the core library I hope to add a nice "backend" example that will allow editing of the values by group.

As a final titbit I decided to use serialize/unserialize to allow storing arrays in the database! As far as I know there are not many other web apps that allow this!

One of the big concerns I have about this is that loading a lot of values from a database will have quite a big overhead. I just dont know yet quite how it is going to react to this until I get things done. Certainly I'm not going to advise storing ALL an applications data in this way!

I also have a nice idea for Xgrid that I came up with - which would be an automatic grid controller.... hmmmm.