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
Laravel Config Writer

Laravel Config Writer Laravel Package

winter/laravel-config-writer

A Laravel package for writing and updating configuration files at runtime. It lets you modify config values programmatically and save them back to disk, making dynamic settings changes easier without manual file edits.

View on GitHub
Deep Wiki
Context7

Utility to create and update Laravel config and .env files

Frequently asked questions about Laravel Config Writer
How do I install winter/laravel-config-writer in a Laravel app?
Install it with composer require winter/laravel-config-writer. The package uses Laravel package auto-discovery, so its service provider is registered without manual edits. The license is MIT and no schema or infrastructure change is required. The API surface is small enough to wrap behind your own interface.
Which Laravel and PHP versions does winter/laravel-config-writer support?
Check the constraint line in the package's composer.json against your current and next-upgrade targets before pinning it. The package comes from the Winter CMS org and is exercised by their setup and update flow, but that does not guarantee broad version coverage. Verify it in a staging app rather than assuming compatibility.
Does winter/laravel-config-writer work when config:cache is enabled?
Writing the config file has no effect while cached configuration or OPcache is serving stale values. You must run php artisan config:clear or rebuild the cache after writing. This is the most likely worked-locally, failed-in-production failure mode.
Does winter/laravel-config-writer preserve comments and formatting in config files?
It depends on whether the package uses an AST parser such as nikic/php-parser or a regex or var_export approach. Regex and var_export writers can drop comments, reorder keys, and change quoting or escaping. Read the source before relying on it for hand-edited config files.
How does winter/laravel-config-writer handle booleans, null, floats, and enums?
Type coercion is a real risk: true can become '1', null can become an empty string, and integers can become strings. Version 1.2.2 added support for doubles, which confirms that floats were mishandled up to and including 1.2.1. Treat the type matrix as partially proven and test booleans, null, floats, enums, backed enums, DateTimeInterface, and nested arrays with numeric keys.
Can winter/laravel-config-writer update .env files at runtime?
Yes, it reads and rewrites .env key/value pairs. Values containing #, spaces, quotes, or multi-line content are where env writers commonly break, so test those cases explicitly. Writing secrets to disk widens the blast radius, so check file permissions, backups, log leakage, and accidental commits.
Are writes from winter/laravel-config-writer atomic and safe for production?
Verify whether writes use a temp file plus rename or a direct file_put_contents call, and add atomic writes and permission handling yourself if they are missing. On-disk config mutation also conflicts with multi-node fleets, read-only container filesystems, and serverless environments such as Lambda or Vapor. It fits installer and setup-wizard flows far better than request-path features.
How should I test code that uses winter/laravel-config-writer?
Wrap the package behind your own interface and point it at a temporary directory in tests rather than a real .env or config file. Assert the exact resulting file contents, including quoting, escaping, and key order, rather than only checking that the call succeeded. Include cases for booleans, null, floats, strings with spaces or hashes, and nested arrays. Then verify config-cache clearing behavior separately.
What are alternatives to winter/laravel-config-writer for dynamic Laravel settings?
For database-backed runtime settings, spatie/laravel-settings is a common choice. For deploy-time configuration, environment variables and git-tracked config files are safer than runtime file writes. If you truly need to rewrite PHP config files, a small custom writer using nikic/php-parser or a dedicated env writer may be more predictable.
Is winter/laravel-config-writer actively maintained and safe to depend on?
It is maintained by the Winter CMS org and used in their setup and update flow, which is a positive provenance signal. However, it has around 16 stars and 0 dependents, so peer vetting is minimal. The 1.2.2 float fix shows the maintainer still patches correctness bugs rather than only dependency bumps. Pin the version and review the source before relying on it.
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