Yaml

Yaml offers convenience methods to load and dump YAML.

author

Fabien Potencier

api

Methods

enablePhpParsing

enablePhpParsing() 
static

Parses YAML into a PHP array.

parse(string $input) : array
static api

The parse method, when supplied with a YAML stream (string or file), will do its best to convert YAML in a file into a PHP array.

Usage:

$array = Yaml::parse('config.yml'); print_r($array);
throws

If the YAML is not valid

Arguments

$input

string

Path to a YAML file or a string containing YAML

Response

array

The YAML converted to a PHP array

Dumps a PHP array to a YAML string.

dump(array $array, integer $inline = 2) : string
static api

The dump method, when supplied with an array, will do its best to convert the array into friendly YAML.

Arguments

$array

array

PHP array

$inline

integer

The level where you switch to inline YAML

Response

string

A YAML string representing the original PHP array

Properties

enablePhpParsing

enablePhpParsing : 
static