Public Member Functions | |
load ($input) | |
loadFile ($file) | |
dump ($array, $indent=false, $wordwrap=false) | |
revertLiteralPlaceHolder ($lineArray, $literalBlock) | |
Static Public Member Functions | |
static | YAMLLoad ($input) |
static | YAMLLoadString ($input) |
static | YAMLDump ($array, $indent=false, $wordwrap=false) |
Public Attributes | |
$setting_dump_force_quotes = false | |
$setting_use_syck_is_possible = false | |
$_nodeId |
Spyc::dump | ( | $ | array, | |
$ | indent = false , |
|||
$ | wordwrap = false | |||
) |
Dump PHP array to YAML
The dump method, when supplied with an array, will do its best to convert the array into friendly YAML. Pretty simple. Feel free to save the returned string as tasteful.yaml and pass it around.
Oh, and you can decide how big the indent is and what the wordwrap for folding is. Pretty cool -- just pass in 'false' for either if you want to use the default.
Indent's default is 2 spaces, wordwrap's default is 40 characters. And you can turn off wordwrap by passing in 0.
public
array | $array PHP array | |
int | $indent Pass in false to use the default, which is 2 | |
int | $wordwrap Pass in 0 for no wordwrap, false for default (40) |
Spyc::load | ( | $ | input | ) |
Spyc::loadFile | ( | $ | file | ) |
static Spyc::YAMLDump | ( | $ | array, | |
$ | indent = false , |
|||
$ | wordwrap = false | |||
) | [static] |
Dump YAML from PHP array statically
The dump method, when supplied with an array, will do its best to convert the array into friendly YAML. Pretty simple. Feel free to save the returned string as nothing.yaml and pass it around.
Oh, and you can decide how big the indent is and what the wordwrap for folding is. Pretty cool -- just pass in 'false' for either if you want to use the default.
Indent's default is 2 spaces, wordwrap's default is 40 characters. And you can turn off wordwrap by passing in 0.
public
array | $array PHP array | |
int | $indent Pass in false to use the default, which is 2 | |
int | $wordwrap Pass in 0 for no wordwrap, false for default (40) |
static Spyc::YAMLLoad | ( | $ | input | ) | [static] |
Load YAML into a PHP array statically
The load method, when supplied with a YAML stream (string or file), will do its best to convert YAML in a file into a PHP array. Pretty simple. Usage: $array = Spyc::YAMLLoad('lucky.yaml'); print_r($array);
public
string | $input Path of YAML file or string containing YAML |
static Spyc::YAMLLoadString | ( | $ | input | ) | [static] |
Load a string of YAML into a PHP array statically
The load method, when supplied with a YAML string, will do its best to convert YAML in a string into a PHP array. Pretty simple.
Note: use this function if you don't want files from the file system loaded and processed as YAML. This is of interest to people concerned about security whose input is from a string.
Usage: $array = Spyc::YAMLLoadString("---\n0: hello world\n"); print_r($array);
public
string | $input String containing YAML |