Yaml
in package
Yaml helper class
Tags
Table of Contents
- parse() : array<string|int, mixed>
- Parses supplied YAML contents in to a PHP array.
- parseFile() : array<string|int, mixed>
- Parses YAML file contents in to a PHP array.
- render() : mixed
- Renders a PHP array to YAML format.
Methods
parse()
Parses supplied YAML contents in to a PHP array.
public
parse(string $contents) : array<string|int, mixed>
Parameters
- $contents : string
-
YAML contents to parse.
Return values
array<string|int, mixed> —The YAML contents as an array.
parseFile()
Parses YAML file contents in to a PHP array.
public
parseFile(string $fileName) : array<string|int, mixed>
Parameters
- $fileName : string
-
File to read contents and parse.
Return values
array<string|int, mixed> —The YAML contents as an array.
render()
Renders a PHP array to YAML format.
public
render([array<string|int, mixed> $vars = [] ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $vars : array<string|int, mixed> = []
- $options : array<string|int, mixed> = []
-
Supported options:
- inline: The level where you switch to inline YAML.
- exceptionOnInvalidType: if an exception must be thrown on invalid types.
- objectSupport: if object support is enabled.