internal/toml
PHP 8.1+ TOML 1.0/1.1 parser and encoder. Parse TOML into PHP arrays or an AST, modify and round-trip back to TOML. Simple static API (Toml::parse/parseToArray/encode) for config files and tooling.
parseToArray, encode) avoids overhead.config/toml/) into Laravel’s config/array.MergeConfigReader to support TOML files alongside PHP/ENV/YAML.Toml::parse() facade for convenience.config/*.php).composer require with no global state.| Risk Area | Mitigation Strategy |
|---|---|
| TOML 1.1 Edge Cases | Package is spec-compliant (verified via changelog fixes for bare keys, table arrays). Test with real-world TOML files (e.g., Terraform outputs). |
| Laravel-Specific Gaps | Build a thin wrapper (e.g., LaravelTomlServiceProvider) to bridge TOML files to Laravel’s config system. |
| Performance Overhead | Benchmark against spatie/toml (TOML 0.5.0) and YAML/JSON parsers. TOML should be faster for large configs. |
| AST Complexity | Document when to use AST (e.g., validation) vs. simple parseToArray(). Provide examples for common transformations. |
| PHP 8.1+ Dependency | Ensure CI/CD pipelines and shared hosting support PHP 8.1+. If not, propose a polyfill or fallback to spatie/toml. |
| Round-Trip Stability | Test format preservation (hex numbers, comments, trailing commas) in CI. |
symfony/yaml or webonyx/graphql-php.config/array) or replace them entirely?php artisan toml:validate)?spatie/toml or custom parsers.config/*.php via a custom config reader..env.toml (e.g., APP_DEBUG = true) alongside .env.cache()->forever('toml:config', $parsedArray)).| Phase | Action | Tools/Libraries |
|---|---|---|
| Assessment | Audit existing configs (YAML/JSON/PHP) for TOML migration candidates. | symfony/yaml, spatie/array-to-object |
| Pilot | Replace 1–2 config files (e.g., config/terraform.toml) with TOML. |
internal/toml, custom service provider |
| Core Integration | Extend Laravel’s config loader to support TOML files. | Illuminate/Config, Illuminate/Filesystem |
| Tooling | Add TOML support to Artisan commands, Laravel Mix, and CI/CD. | laravel/framework, laravel/mix |
| Deprecation | Phase out YAML/JSON configs in favor of TOML (optional). | Custom deprecation warnings |
spatie/toml.array, DateTimeImmutable, JsonSerializable.key = "value" vs. [key] = "value").database.host).[[servers]]).spatie/toml or custom parsers with internal/toml.config/toml/).Toml::encode() for API responses, exportable configs, or dynamic TOML generation.internal/toml for TOML 1.2 or PHP 8.2+ compatibility.pestphp) for TOML edge cases.php artisan toml:make scaffold for new TOML configsHow can I help you explore Laravel packages today?