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

Yaml Laravel Package

pragmarx/yaml

PragmaRX YAML is a lightweight Laravel and PHP package for parsing and dumping YAML. It wraps Symfony's YAML component with a simple service provider and facade, making it easy to load YAML config or translation files, convert YAML strings to arrays, and export arrays back to YAML.

View on GitHub
Deep Wiki
Context7

pragmarx/yaml brings YAML parsing and dumping to Laravel through a lightweight wrapper around Symfony’s YAML component. It provides a familiar facade for converting YAML documents into PHP arrays and serializing arrays back into YAML, making it useful for configuration, fixtures, and data exchange.

  • Parse YAML strings into PHP arrays
  • Dump PHP arrays and values as YAML
  • Laravel service provider and Yaml facade
  • Built on Symfony’s mature YAML component
Frequently asked questions about Yaml
How do I install pragmarx/yaml in a Laravel application?
Install it with Composer using composer require pragmarx/yaml, then let Laravel package auto-discovery register the service provider and facade. Publish any package config if the README instructs it. Before adopting, pin a version and verify its illuminate/support and symfony/yaml constraints against your lockfile, because the package is a May 2020 release and may not install cleanly on current Laravel and PHP versions.
Does pragmarx/yaml support Laravel 10, 11, or 12?
There is no validated support matrix for Laravel 10, 11, or 12 in the provided evaluation; the release is from May 2020, before those majors. Laravel's LoadConfiguration, provider ordering, and config repository hydration have changed across L8-L12, so a 2020-era provider is unlikely to be validated against current versions. Run a half-day spike on your exact PHP and Laravel versions before relying on it.
How does pragmarx/yaml handle config:cache?
config:cache compatibility is unverified and is a hard blocker if broken. Because the package sits on Laravel's bootstrap path and replaces the native config loader, you must test php artisan config:cache and config:clear and dump resolved values in a throwaway branch. Also check whether YAML is re-parsed per request when config is not cached.
Can I use env() variables inside YAML config files with pragmarx/yaml?
YAML is static, so Laravel's env() interpolation has no obvious built-in equivalent in this package, creating a secret-injection gap. Do not put plaintext secrets in YAML. If you proceed, add an explicit environment-substitution pass at build or deploy time, or compile YAML to PHP config before runtime, and review how the loader handles values that look like env() calls.
Can pragmarx/yaml and native PHP config files coexist in the same Laravel app?
The package is described as swapping Laravel's native PHP config loader for a Symfony YAML-backed one, so treat mixing config/*.php and YAML as all-or-nothing unless your spike proves otherwise. Keep critical Laravel config in native PHP and isolate any YAML to one non-critical domain. Do not convert config/*.php wholesale.
How do I read and dump YAML files with the pragmarx/yaml facade?
Use the package's facade and service provider integration to parse YAML files and dump arrays or objects to YAML. For direct parsing, it wraps Symfony's YAML component, so use explicit safe flags and avoid object instantiation from untrusted YAML. Validate parsed output in CI rather than assuming type coercion matches PHP.
Is pragmarx/yaml safe for production YAML parsing?
It is not safe as a wholesale production config replacement without review. YAML adds failure modes PHP does not have, including indentation errors, anchors, type coercion such as yes becoming true, and unquoted version strings, and a parse error at boot is an outage. Symfony YAML's object-instantiation behavior requires explicit safe flags, and the package has no CVE-monitoring footprint from this evaluation.
What are alternatives to pragmarx/yaml for YAML config in Laravel?
Prefer Laravel's native PHP config for critical settings, or use Symfony's YAML component directly in a small in-house loader with safe flags and an env-substitution pass. A build-time approach that validates YAML in CI and compiles it to a cached PHP config file preserves YAML authoring benefits while keeping Laravel's zero-dependency, config:cache-compatible runtime path. If runtime YAML is mandatory, fork this package under an internal namespace.
How do I test pragmarx/yaml with Octane or read-only filesystems?
Test under config:cache, config:clear, Laravel Octane worker-boot persistence, and read-only filesystems. Confirm that no runtime code writes YAML or cache files and that resolved config survives worker reuse. If YAML is reparsed per request without config caching, measure the performance cost before shipping.
Is pragmarx/yaml maintained, and should I fork it?
It is effectively unmaintained: a May 2020 release, 114 stars, zero dependents, and no upstream velocity, though it is MIT-licensed and fork-friendly. You inherit compatibility patching on every Laravel and PHP upgrade, and there are no dependents to surface breakage. If runtime YAML is a hard requirement, fork it under an internal namespace so upgrades are yours to control; otherwise treat it as a reference implementation, not a dependency of record.
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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console