Let's get to know Yaml:yaml profile

Source: Internet
Author: User

Yaml

Definition from the YAML official website (http://www.yaml.org/): Yaml is an intuitive data serialization format that can be read by a computer, easily accessible by humans, and easily interacting with scripting languages. To put it another way, Yaml is a very simple XML-like Data description language, and syntax is much simpler than XML. He is very useful in describing data that can be converted into clusters or hashes, such as:

$house = Array (
' Family ' => Array (
' Name ' => ' Doe ',
' Parents ' => array (' John ', ' Jane '),
' Children ' => Array (' Paul ', ' Mark ', ' Simone ')
),
' Address ' => array (
' Number ' => 34,
' Street ' => ' Main Street ',
' City ' => ' Nowheretown ',
' ZipCode ' => ' 12345 '
)
);

Parsing this yaml will automatically create the following PHP array:

House
Family
Name:doe
Parents
-John
-Jane
Children
-Paul
-Mark
-Simone
Address
Number:34
Street:main Street
City:nowheretown
zipcode:12345

Inside the YAML, the structure is expressed by indenting, successive items are represented by a minus sign "-", and the key/value in the map structure is delimited by a colon ":". Yaml is also useful to describe the abbreviated syntax for several lines of identical structure data, which are included with ' [] ', and the hash is included with ' {} '. So, this yaml in front can be abbreviated like this:

House
Family: {name:doe, parents: [John, Jane], children: [Paul, Mark, Simone]}
Address: {number:34, Street:main Street, City:nowheretown, zipcode:12345}

YAML is the abbreviation for "yet Another Markup Language (another Markup language)", pronunciation "Yamel", or "Jamel". This format is about 2001, and so far there are yaml parsers in many languages.

Hint YAML format of the specific specifications can be found in the YAML official website http://www.yaml.org/.

As you can see, writing Yaml is much faster than XML (no need to turn off tags or quotes) and is more powerful than '. ini ' file (INI file does not support hierarchy). So Symfony chooses YAML as the preferred format for configuration information. You'll see a lot of yaml files in this book, but it's intuitive that you don't need to delve into YAML.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.