December 13, 2009

config file format

Tags: , , , , ,
Filed under: ZenMagick — DerManoMann @ 10:34 pm

I’ve refactored the url mapping code and also added code to load YAML formatted mappings. This is working great and beside the fazt that the default mappings are now in a config file and not a function the new mapping is a lot more efficient and fixes a couple bugs/limitations as well!

Other places where YAML could/should be used:

  • default sacs mappings
  • database mappings
  • Settings
  • other suggestions?

December 11, 2009

YAML to the rescue?

Tags: , , , , ,
Filed under: ZenMagick — DerManoMann @ 12:33 am

… yes, YAML to the rescue!

A while ago I was asking for alternative config file formats. I finally seem to have found a strong candidate: YAML!

It’s readable, flexible, supports hierarchical structures and best of all there are pure PHP parsers available!
I’ve picked spyc for some experiments and, in fact, already added that to the repository! spyc seems a very active project and does have good speed.

As a quick test I wrote some debug code to dump the url mappings as YAML. Then, I modified the url mapper to load that mapping using spyc rather than using it’s own mappings. And – voila! It works!

Now I can work on the YAML formatted mappings without having to create nested arrays or anything – what a relief!