Library for working with yaml text format.
- Read from string:
use std;
$data = str::parseAs('name: value', 'yaml');
echo $data['name']; // value.
- Write to string:
use std;
$yamlString = str::formatAs(['name' => 'value'], 'yaml');
echo $yamlString;
- Read from file:
use std;
$data = fs::parseAs('path/to/file.yml', 'yaml');
- Write to file:
use std;
fs::formatAs('path/to/file.yml', ['name' => 'value'], 'yaml');
- Read from stream:
use std;
$stream = Stream::of('http://example.com/file.yml');
$data = $stream->parseAs('yaml');
- Write to stream:
use std;
$stream = Stream::of('file.yml', 'w+');
$data = $stream->writeFormatted(['name' => 'value'], 'yaml');
$stream->close();