I have a YAML file I'd like to right to in this format:

-
  namespace: content
  hook: testing
-
  namespace: content
  hook: testing2
-
  namespace: test
  hook: foo

I want to programmatically add another entry. If I do this:

        $data = array();

        $data['namespace'] = $namespace;
        $data['hook'] = $hook;

        $this->storage->append('hooks', YAML::dump($data));

I get:

---
namespace: foo
hook: bar

I have my YAML mode set to loose (Dipper won't parse the file).

How can I write out that YAML?

Answered by Jason Varga! Go to answer.