Symfony\Component\Yaml\Yaml::parse
Parses YAML into a PHP array.
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: <code> $array = Yaml::parse('config.yml'); print_r($array); </code> As this method accepts both plain strings and file names as an input, you must validate the input before calling this method. Passing a file as an input is a deprecated feature and will be removed in 3.0.
Signature
public function parse(string
$input,
[Boolean
$exceptionOnInvalidType = false,
[Boolean
$objectSupport = false]] )
Parameters
$input
— string- Path to a YAML file or a string containing YAML
$exceptionOnInvalidType
— object- True if an exception must be thrown on invalid types false otherwise
$objectSupport
— object- True if object support is enabled, false otherwise
Returns
- array
- The YAML converted to a PHP array
Errors/Exceptions
-
ParseException
- If the YAML is not valid