switon/yaml

Strict Switon YAML subset parsing with placeholder interpolation for Switon Framework

Maintainers

Package info

github.com/switon-php/yaml

Documentation

pkg:composer/switon/yaml

Statistics

Installs: 29

Dependents: 3

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-06-06 13:43 UTC

This package is auto-updated.

Last update: 2026-06-07 02:28:49 UTC


README

YAML CI PHP 8.3+

Switon's strict YAML subset parser and placeholder resolver for predictable config documents.

Highlights

  • Strict YAML subset: only the supported Switon YAML features are parsed.
  • Single-step read: YAML can be parsed and interpolated at once.
  • Predictable failures: parse errors are reported clearly.
  • Config-friendly output: the result is a plain PHP array for config loading.

Installation

composer require switon/yaml

Quick Start

use Switon\Core\Attribute\Autowired;
use Switon\Yaml\YamlReaderInterface;

class ConfigService
{
    #[Autowired] protected YamlReaderInterface $yamlReader;

    public function load(string $yaml): array
    {
        return $this->yamlReader->read($yaml, ['APP_ENV' => 'prod']);
    }
}

Docs: https://docs.switon.dev/latest/yaml

License

MIT.