a SENSIOLABS Product
Symfony

YAML
A PHP library that speaks YAML

sfYaml Class

All Classes

  • sfYaml: sfYaml offers convenience methods to load and dump YAML.
  • sfYamlDumper: sfYamlDumper dumps PHP variables to YAML strings.
  • sfYamlInline: sfYamlInline implements a YAML parser/dumper for the YAML inline syntax.
  • sfYamlParser: sfYamlParser parses YAML strings to convert them to PHP arrays.

RELEASE INFORMATION

You are currently browsing the API for the trunk version.
sfYaml offers convenience methods to load and dump YAML.

METHODS
setSpecVersion()  sets the YAML specification version to use.
getSpecVersion()  gets the YAML specification version to use.
load()  loads YAML into a PHP array.
dump()  dumps a PHP array to a YAML string.
echoln()  wraps echo to automatically provide a newline.
  • setSpecVersion($version)

    Sets the YAML specification version to use.

    ARGUMENTS
    $version The YAML specification version
  • (string) getSpecVersion()

    Gets the YAML specification version to use.

    returns The YAML specification version

  • (array) load($input)

    Loads YAML into a PHP array.


    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.

    Usage:

    $array = sfYaml::load('config.yml');
    print_r($array);

    ARGUMENTS
    $input Path of YAML file or string containing YAML

    returns The YAML converted to a PHP array

    throws InvalidArgumentException If the YAML is not valid

  • (string) dump($array, $inline)

    Dumps a PHP array to a YAML string.


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

    ARGUMENTS
    $array PHP array
    $inline The level where you switch to inline YAML

    returns A YAML string representing the original PHP array

  • echoln($string)

    Wraps echo to automatically provide a newline.

    ARGUMENTS
    $string The string to echo with new line
powered by symfony - "symfony" is a trademark of Fabien Potencier, all rights reserved - The components "animals" are © 2009 Sensio Labs

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.