Weave Code
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
Config Transformer

Config Transformer Laravel Package

symplify/config-transformer

Automates refactoring and normalization of configuration files, helping you transform legacy or inconsistent configs into a unified format. Supports common PHP config styles and streamlines upgrades by applying consistent, repeatable changes across large codebases.

View on GitHub
Deep Wiki
Context7

Convert Symfony YAML configs to PHP format

Frequently asked questions about Config Transformer
Can I use symplify/config-transformer to migrate Symfony YAML configs to Laravel’s PHP config format?
Yes, this package is designed to convert Symfony-style YAML configs into PHP arrays, which Laravel’s config system natively supports. It’s ideal for projects transitioning from Symfony or maintaining hybrid architectures. Place YAML files in a directory (e.g., `config/raw/`) and run the transformer to generate PHP configs in Laravel’s `config/` folder.
How do I install symplify/config-transformer in a Laravel project?
Run `composer require symplify/config-transformer --dev` to install it as a development dependency. The package provides a CLI command (`vendor/bin/config-transformer`) to transform configs. Start with `--dry-run` to preview changes before applying them. For Laravel integration, consider adding a custom Artisan command or Composer script to automate the process.
Does symplify/config-transformer support Laravel-specific config syntax like `env()` placeholders?
The package handles basic PHP syntax, but Laravel-specific features like `env()` placeholders may require custom transformers. You can extend the default mappings or use the `--skip-routes` flag if you’re migrating incrementally. For complex cases, review the [Symplify documentation](https://github.com/symplify/config-transformer) or create a custom transformer class.
Will this package break existing Laravel config loaders or service providers?
No, the package operates on files and doesn’t modify runtime behavior. However, ensure your Laravel config loaders (e.g., `Config::load()` or service providers) are compatible with PHP arrays. Test thoroughly, especially if you use custom config resolvers or dynamic loading logic. The transformed configs will replace YAML/XML files, so validate your application’s config-driven features post-migration.
Can I use symplify/config-transformer in CI/CD pipelines to auto-generate configs?
Absolutely. The package is designed for automation—add it to your CI/CD workflow (e.g., GitHub Actions) to transform configs on every push or deploy. Use `--dry-run` in pre-deployment checks to catch issues early. For Laravel, you might also trigger it via a Composer script (e.g., `post-install-cmd`) or a custom Artisan command tied to deployment hooks.
What Laravel versions does symplify/config-transformer support?
The package itself is framework-agnostic but works seamlessly with Laravel 8+ due to its PHP-native config system. For older Laravel versions (7.x), ensure your config loaders support PHP arrays. The transformer’s output is compatible with any Laravel version that uses `config/` for configuration, but test edge cases like environment-specific configs or dynamic loading.
How do I handle circular references or complex YAML structures in Symfony configs?
Symplify’s transformer leverages Symfony’s `ReferenceNode` handling to manage circular references (e.g., YAML anchors/aliases). For complex structures like nested includes or custom tags, use the `--dry-run` flag to debug issues. If needed, extend the transformer with custom logic or pre-process YAML files to simplify them before transformation.
Are there alternatives to symplify/config-transformer for converting YAML to PHP in Laravel?
For Laravel-specific needs, consider `spatie/laravel-config-array` for dynamic config loading or `nunomaduro/collision` for config validation. However, `symplify/config-transformer` is uniquely optimized for Symfony-to-PHP conversions with modular, extensible transformers. If you’re migrating from Symfony or need fine-grained control over the process, this package offers superior flexibility.
How do I test Laravel applications after transforming YAML configs to PHP?
Start by testing config-driven features like middleware, queues, or service bindings in isolation. Use PHPUnit to verify that `config('key')` returns expected values. For environment-specific configs (e.g., `.env`-dependent YAML), mock the environment or use Laravel’s `Config::set()` in tests. Validate edge cases like circular dependencies or nested configs with assertions or static analysis tools like PHPStan.
Can I selectively transform only certain YAML files (e.g., skip routes.yaml) in a Laravel project?
Yes, use the `--skip-routes` flag or specify file/directory paths as arguments to target specific configs. For example, `vendor/bin/config-transformer config/services.yaml` will only transform `services.yaml`. This is useful for incremental migrations or projects with mixed YAML/PHP configs. Combine with `--dry-run` to preview changes before applying them.
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.
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor
spatie/laravel-javascript-views