switon / yaml
Strict Switon YAML subset parsing with placeholder interpolation for Switon Framework
v1.0.0
2026-06-06 13:43 UTC
Requires
- php: >=8.3
- ext-json: *
- switon/core: ^1.0
Requires (Dev)
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^12.0
- switon/testing: ^1.0
README
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.