Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Toml Laravel Package

internal/toml

TOML 1.0.0/1.1.0 parser and encoder for PHP 8.1+. Parse TOML files straight into PHP arrays or encode arrays back to TOML, with support for tables, arrays of tables, and standard value types. A small, dependency-free tool for config files.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Configuration format strategy: Deciding whether TOML becomes a first-class config format alongside JSON/YAML/INI. This package covers both directions (parse to arrays, encode from arrays), so it supports adopting TOML without writing custom serialization.
  • Build vs. buy: TOML 1.0/1.1 compliance is deceptively hard (dotted keys, inline tables, date-time variants, hex/octal/binary ints, multiline strings, escape edge cases). Buying a spec-focused parser is cheaper than building and maintaining one — provided the dependency risk below is acceptable.
  • Features enabled by the AST + round-trip API: The Toml::parse() → Document → (string) flow supports format-preserving config mutation. This unlocks product features like config:set, environment editors, and "edit this file without reformatting it" UX, which array-only parsers cannot do cleanly.
  • CLI and codegen tooling roadmap: Encoding PHP arrays/JsonSerializable objects to TOML supports generators for CI templates, Kubernetes/Terraform-adjacent manifests, and fixture authoring — useful for internal developer tooling more than end-user runtime.
  • Use cases worth scoping: application/service config files, PHP CLI config tooling, generated infrastructure configuration, test fixtures, and migrating legacy INI/hardcoded PHP configs to a more readable structured format.
  • Dependency governance decision: With 5 stars, 0 dependents, and a single primary maintainer, this is a pilot-grade dependency, not a platform-grade one. The PM decision is whether to adopt it behind an internal abstraction (recommended) so the parser can be swapped later without touching call sites.

When to Consider This Package

Consider it when:

  • You specifically need both parsing and encoding of TOML on PHP 8.1+, with TOML 1.1 coverage (hex/octal/binary integers, inf/nan, local time with optional seconds, multiline inline tables).
  • You need format-preserving round-trips or AST access — a differentiator versus simpler array-only TOML libraries.
  • The use case is internal tooling, CLI utilities, or generated configs where a small, single-maintainer dependency is an acceptable trade for a clean, modern API.
  • You are willing to wrap it behind an internal adapter (e.g., a ConfigReader/ConfigWriter interface) so migration to another implementation is a one-file change.
  • Your team accepts a BSD-3-Clause license and a low-activity dependency with a changelog and tagged releases.

Look elsewhere when:

  • You need proven production adoption, security audit history, or a broad contributor base — 5 stars and 0 dependents do not support that claim, regardless of code quality.
  • You target PHP < 8.1, or need long-term support guarantees tied to a vendor or foundation.
  • You only need read-only parsing — a smaller, more widely used parser may be a lower-risk choice for a narrower need.
  • You require framework-native integration (Laravel service provider, Symfony bundle, config caching hooks). This package is a library, not an integration; you would own that glue and its caching/precedence behavior.
  • TOML is not already in your stack and the team has no strong reason to prefer it over YAML/JSON — format choice should be driven by ecosystem fit, not novelty.

Adoption guardrail: pilot in one non-critical service, pin an exact version, and add a parse-failure test suite covering your real config surface before wider rollout.

How to Pitch It (Stakeholders)

For executives:

We're evaluating a small library that lets our PHP services read and write TOML configuration files with full TOML 1.1 support and a clean, modern API. The upside is developer ergonomics: TOML is readable, strongly typed, and common in infrastructure tooling (Kubernetes, Terraform ecosystems, Rust), so adopting it can simplify our config story and reduce hand-rolled parsing code. The honest caveat is maturity: it has very low adoption (5 stars, no downstream dependents) and a single primary maintainer. My recommendation is a bounded pilot behind an internal interface, not a platform-wide standard — that captures the ergonomic benefit while keeping our switching cost at roughly one adapter file if the project stalls. This is a low-cost experiment with a capped blast radius, not a strategic bet.

For engineering:

This gives us three things we don't have today: spec-compliant TOML 1.0/1.1 parsing, encoding from PHP arrays and JsonSerializable objects, and an AST with format-preserving round-trips (e.g., magic = 0xDEADBEEF survives a parse/emit cycle). The API is three calls: Toml::parse(), Toml::parseToArray(), Toml::encode(). That makes it a good fit for config readers and for CLI generators where we produce TOML from PHP data.

Trade-offs to plan around: low adoption and a single maintainer mean we must pin versions and own the integration glue (no Laravel/Symfony package exists). There is no config-caching story out of the box, so if we replace framework config files we own loader precedence and cache invalidation. Also note the encoder targets TOML 1.0-compatible output for interoperability even though the parser accepts 1.1 — don't assume 1.1-only syntax survives a round-trip through encode.

Proposal: wrap it behind a ConfigReader/ConfigWriter interface, pilot on one service, add golden-file tests for our real configs, and revisit adoption breadth after a release cycle. If it proves out, we get a clean TOML story; if not, the adapter is our exit.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator