0

I have a set of shipping codes that I want to be able to store in our database. I will be adding to this list in the future, so ideally I'd like to have them in a YML fie that I can just add to. I want to be able to run a task that will populate the DB with the YML data, and will update a record if it notices something has changed. Is there any tool out there in PHP that already does this for me?

j0k
  • 22,600
  • 28
  • 79
  • 90
tesserakt
  • 3,231
  • 4
  • 27
  • 40

3 Answers3

0

Hava a look at Zend_Config, it provides Readers and Writers for YAML, XML, JSON and INI. As for the updating task... you'll have to do that on your own because your database structure is unknown to any existent tool.

Martin Müller
  • 2,565
  • 21
  • 32
  • not really. I am following the Rails convention for naming databases, so I should be able to write a task that reads the YAML key, knows the name of the database (and therefore the name of the model class) and can populate the DB based on the sub attributes. I can write this myself, but was looking for a quick solution. Maybe I will and release it open source. Thanks for the info. – tesserakt Jan 23 '13 at 15:50
0

I'd advise you to take a look at http://www.symfony-project.org/api/1_4/sfYaml. I've used this class separated from the whole Symfony framework and I worked great for me.

Muc
  • 1,464
  • 2
  • 13
  • 31
0

There are many options for you;

http://php.net/manual/en/book.yaml.php

http://pecl.php.net/package/yaml

http://code.google.com/p/spyc/

And: PHP YAML Parsers

Community
  • 1
  • 1
Kerem
  • 11,377
  • 5
  • 59
  • 58