Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Yaml.php

function Yaml::parse

Parses YAML into a PHP value.

Usage: <code> $array = Yaml::parse(file_get_contents('config.yml')); print_r($array); </code>

Parameters

string $input A string containing YAML:

int-mask-of<self::PARSE_*> $flags A bit field of PARSE_* constants to customize the YAML parser behavior:

Throws

ParseException If the YAML is not valid

8 calls to Yaml::parse()
AutoAddedKeysSniff::process in vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/AutoAddedKeysSniff.php
Processes this test, when one of its tokens is encountered.
CoreVersionRequirementSniff::process in vendor/drupal/coder/coder_sniffer/DrupalPractice/Sniffs/InfoFiles/CoreVersionRequirementSniff.php
Processes this test, when one of its tokens is encountered.
DependenciesArraySniff::process in vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/DependenciesArraySniff.php
Processes this test when one of its tokens is encountered.
Extension::parseInfo in vendor/mglaman/phpstan-drupal/src/Drupal/Extension.php
FailureMarker::getData in core/modules/package_manager/src/FailureMarker.php
Gets the data from the file if it exists.

... See full list

File

vendor/symfony/yaml/Yaml.php, line 73

Class

Yaml
Yaml offers convenience methods to load and dump YAML.

Namespace

Symfony\Component\Yaml

Code

public static function parse(string $input, int $flags = 0) : mixed {
    $yaml = new Parser();
    return $yaml->parse($input, $flags);
}
RSS feed
Powered by Drupal