Symfony Yaml

PHP component for parsing and dumping YAML files, used throughout the Symfony framework

Library
Composer
vv8.1.2
3,839stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
89/100Excellent
Development Activity100
Maintenance96
Community60
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
80/100Excellent
Architecture83
Code Quality86
Innovation70
Learning Curve82

Symfony Yaml is a PHP library that converts YAML documents into native PHP arrays and objects (Yaml::parse, Yaml::parseFile) and serializes PHP data structures back into YAML (Yaml::dump). It implements the YAML 1.2 specification closely enough to pass the official yaml-test-suite, while offering Symfony-specific extensions like parsing PHP constants, objects, and custom tags via bitmask flags.

As one of Symfony’s foundational components, it underpins configuration loading across the framework (service definitions, routing, and application config) but is fully decoupled and usable standalone in any PHP 8.4+ project. It ships a yaml-lint CLI binary and a LintCommand for integrating YAML validation into Symfony Console applications, plus detailed parse exceptions that report the exact line and context of a syntax error.

What You Get

  • Yaml::parse/Yaml::parseFile to load YAML strings or files into PHP arrays, objects, or constants
  • Yaml::dump to serialize PHP arrays and objects back into YAML text with configurable inline depth and indentation
  • A bitmask of PARSE_*/DUMP_* flags for behaviors like parsing PHP constants, custom tags, or dumping objects as YAML maps
  • A yaml-lint CLI binary and LintCommand for validating YAML files from the command line or a Symfony Console app
  • Detailed ParseExceptions that report the exact line number and surrounding context of invalid YAML

Common Use Cases

  • Loading application configuration files (services, routing, environment-specific settings) in a Symfony or standalone PHP project
  • Validating YAML files in CI via the bundled yaml-lint command before deployment
  • Converting PHP data structures to human-readable YAML for config export, fixtures, or API documentation snippets
  • Parsing third-party YAML files (CI pipelines, OpenAPI specs, Docker Compose files) inside a PHP tool

Under The Hood

Architecture - The component separates parsing from dumping across two focused classes: Parser.php (1,332 lines) implements a recursive-descent parser that walks YAML line-by-line, tracking indentation and nesting to build a PHP value tree, while Inline.php (983 lines) handles single-line/flow-style YAML fragments ({key: value}, [a, b]) shared by both parsing and dumping. Dumper.php (199 lines) walks a PHP value and serializes it back to YAML text using the same Inline helpers for scalar formatting. The public entry point, Yaml.php, is a thin static facade (parse/parseFile/dump) over Parser and Dumper, keeping the internal classes swappable without breaking the documented API. Tech Stack - Requires PHP 8.4.1+, with symfony/polyfill-ctype as the only hard runtime dependency; symfony/console is an optional dev/conflict dependency used solely to power the LintCommand integration. The Yaml\ namespace is autoloaded via PSR-4, and the package declares a bin/yaml-lint executable installed alongside the library. Code Quality - The Tests/ directory includes dedicated suites for the parser, dumper, inline handling, exceptions, and a YamlTestSuiteTest that runs the component against the official cross-language yaml-test-suite fixtures, giving strong confidence in spec conformance across edge cases (anchors, merge keys, multi-document streams). Error handling is deliberate: ParseException captures the parsed line number and snippet rather than failing with a generic message. API Design - The static Yaml::parse/Yaml::dump facade requires no instantiation for the common case, while power users can flag in specific behaviors (object parsing, constant resolution, custom tags) via well-documented bitmask constants rather than a sprawling options array. Every public method carries a full PHPDoc block with parameter semantics, keeping IDE autocompletion and static analysis useful even without reading the source.

Used by 11 apps in this directory

PHP
63%
Other

BillaBear

Ecommerce · Invoicing Finance

754

Self-hostable subscription management and billing platform with Stripe integration, tax automation, configurable workflows, and Twig-based document generation.

View details
47
Repo Health
66
Technical
66
Dependency
Built with
PHP63%
Vue18%
Gherkin13%
Updated 2 months ago
PHP
79%
Apache 2.0

Coolify

Devops · Hosting Control Panel

60,738

Open-source self-hosted PaaS — deploy apps, databases and 280+ services on your own servers with no vendor lock-in

View details
92
Repo Health
86
Technical
72
Dependency
Built with
PHP79%
Blade18%
Updated yesterday
PHP
78%
Other

Craft CMS

CMS

3,601

A developer-first PHP CMS with clean-slate content modeling, auto-generated GraphQL API, and a four-tier edition system that scales from solo projects to enterprise deployments.

View details
96
Repo Health
83
Technical
63
Dependency
Built with
PHP78%
JavaScript14%
Updated today
PHP
63%
AGPL 3.0

Hyvor Relay

Devops · AI Development · Monitoring

819

Self-hosted, open-source email API that automates DNS, manages SMTP delivery, and provides deep observability — replacing SES, Mailgun, and SendGrid with infrastructure you fully own.

View details
69
Repo Health
79
Technical
70
Dependency
Built with
PHP63%
Svelte23%
Go12%
Updated today
PHP
86%
AGPL 3.0

Kimai

Invoicing Finance · Project Management

4,918

Professional open-source time tracking with invoicing, multi-user support, SAML/LDAP auth, and a full REST API—self-host it or use the cloud.

View details
94
Repo Health
78
Technical
63
Dependency
Built with
PHP86%
Updated today
PHP
48%
AGPL 3.0

Leantime

Productivity · Project Management · Collaboration

11,391

Project management built for ADHD, autism, and dyslexia — simple as Trello, powerful as Jira

View details
90
Repo Health
68
Technical
67
Dependency
Built with
PHP48%
CSS20%
Blade17%
Updated 4 days ago
PHP
65%
AGPL 3.0

LinkStack

Marketing

3,797

Self-hosted, privacy-focused Linktree alternative with themes, analytics, and a drag-and-drop admin panel.

View details
75
Repo Health
56
Technical
68
Dependency
Built with
PHP65%
Blade35%
Updated 4 weeks ago
PHP
79%
GPL 3.0

matomo

Analytics

21,786

Open-source, privacy-first web and app analytics that puts you in complete control of your data.

View details
95
Repo Health
82
Technical
62
Dependency
Built with
PHP79%
Updated today
Java
92%
Apache 2.0

QuestDB

Databases · Analytics

17,263

A high-performance, open-source time-series database built for financial market data, IoT telemetry, and real-time analytics, combining a zero-GC Java/C++ core with SIMD-accelerated SQL and a WAL-to-Parquet storage engine.

View details
91
Repo Health
86
Technical
70
Dependency
Built with
Java92%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search