Skip to content

Support Matrix

This page describes what the library supports today, what is partial, and what is not implemented yet.

It is intentionally narrower than a blanket "full TOML support" claim. The goal is to document observed behavior that is backed by the current code and test suite.

Status Legend

  • Supported: implemented and covered by tests
  • Partial: implemented in a limited way, or decoder and encoder differ
  • Not Yet: not implemented, not preserved, or intentionally out of scope today

Parsing and Decoding

Keys and Tables

FeatureStatusNotes
Bare keysSupported
Quoted keysSupportedBasic and literal quoted keys are accepted
Empty quoted keysSupportedExample: "" = 1
Dotted keysSupported
Standard tablesSupported
Array of tablesSupportedNested array-of-tables is covered by tests
Duplicate key detectionSupportedRejected as semantic errors
Duplicate table detectionSupportedRejected as semantic errors
Key/table redefinition conflictsSupportedRejected as semantic errors

Values

FeatureStatusNotes
Basic stringsSupported
Literal stringsSupported
Multiline basic stringsSupported
Multiline literal stringsSupported
\u and \U escapesSupported
\xHH escapesSupportedTOML 1.1
\e escapeSupportedTOML 1.1
Invalid escape rejectionSupported
IntegersSupportedDecimal, hex, octal, binary
Float valuesSupportedIncludes exponent form
inf, -inf, nanSupported
Boolean valuesSupported
Offset datetimeSupported
Local datetimeSupported
Local dateSupported
Local timeSupportedOptional seconds supported

Collections

FeatureStatusNotes
ArraysSupported
Multiline arraysSupported
Array trailing commasSupported
Inline tablesSupportedSingle-line and multiline
Nested inline tablesSupported
Dotted keys inside inline tablesSupported
Inline table trailing commasSupportedTOML 1.1
Multiline inline tablesSupportedTOML 1.1

Encoding

FeatureStatusNotes
StringsSupportedEncoded as basic strings
IntegersSupported
FloatsSupported
BooleansSupported
ArraysSupported
Nested tablesSupported
Array of tablesSupported
Quoted keys when neededSupported
DateTimeInterfacePartialEncoded as offset datetime with microseconds and offset
PhpCollective\Toml\Value\LocalDateSupportedEncoded as local date literal
PhpCollective\Toml\Value\LocalTimeSupportedEncoded as local time literal
PhpCollective\Toml\Value\LocalDateTimeSupportedEncoded as local datetime literal
Plain string to local temporal literal coercionNot YetPlain strings are emitted as quoted strings
Null valuesSupportedRejected with EncodeException
Original lexical style preservationPartialencodeDocument() can preserve parsed key and string styles

AST and Round-Trip Editing

FeatureStatusNotes
AST node accessSupported
Span informationSupported
Trivia preservation on document items and table entriesPartialAvailable through Toml::parse($input, true) for leading/trailing trivia on parsed items
Trivia preservation inside parsed arrays and inline tablesPartialCollection-local item spacing and comments are preserved where represented in the AST
Comment preservation on re-encodePartialPreserved for parsed document items, table entries, and collection items when trivia is available
Formatting preservation on re-encodePartialAvailable in DocumentFormattingMode::SourceAware for trivia-preserving ASTs
encodeDocument() round-trip fidelityPartialNormalized by default; source-aware mode is lossless for unchanged parsed documents and local-fallback for edited regions

Tooling and Errors

FeatureStatusNotes
Toml::decode()SupportedThrows ParseException on invalid input
Toml::tryParse()SupportedReturns collected parse and semantic errors
Multiple error collectionPartialRecovery exists, but is line-oriented and not conformance-grade
Error spans and formattingSupported

Known Gaps

  • The decoder supports more TOML temporal forms than the encoder can emit.
  • AST editing falls back to canonical local formatting when new nodes do not carry trivia or when single-line collection shape changes do not expose a consistent delimiter style to preserve.
  • Fallback behavior is local rather than globally lossless: nested edited collections may normalize while outer layout stays preserved.
  • Small value-only edits can preserve original key/value separator spacing.
  • Inline table formatting options beyond key sorting and newline selection are not implemented.

toml-test Compliance

Tested against toml-test v2.1.0:

TOML 1.1

Test TypePassedFailedCompliance
Valid213199.5%
Invalid466998.1%

TOML 1.0

Test TypePassedFailedCompliance
Valid204199.5%
Invalid4661796.5%

The single valid test failure is due to a PHP limitation with null byte property names.

The remaining invalid test failures are TOML 1.0 strict tests for features that TOML 1.1 relaxes (multiline inline tables, trailing commas, \xHH escapes, optional seconds in times).

This library is well suited for:

  • parsing and validating TOML configuration files
  • collecting syntax and semantic errors for IDE/tooling integration
  • encoding PHP arrays into TOML
  • round-trip editing with comment and formatting preservation
  • AST-based TOML analysis and transformation

Released under the MIT License.