stillat/proteus
Proteus parses, updates, and writes Laravel-style PHP configuration files. Its ConfigWriter facade simplifies changing nested or multiple values, previewing output, guarding entries, and optionally rewriting function calls.
app.php, database.php, or a package's own config file on the customer's behalf. A "one command to configure" flow measurably improves activation and cuts support tickets caused by hand-edited PHP arrays and stray commas.env() calls. Reproducing that with nikic/php-parser plus a printer is weeks of engineering for a small, MIT-licensed dependency. Building in-house is only justified if you already own a PHP-AST editor.config/app.php" as a generated step, not a copy-paste doc).guard() protecting app.key, mail credentials, and other sensitive namespaces.Adopt when:
var_export.env() calls left intact by default (the v2 default), with preview/previewMany to show a dry run and guard()/preserve() to enforce policy on protected keys.Look elsewhere or add mitigation when:
env(); use guard() aggressively if you expose any write path to users..env files) or non-Laravel frameworks — it is explicitly scoped to Laravel-style PHP arrays.Validation gate before commitment: run a one-day spike on your three most-edited real config files; confirm round-trip fidelity (comments, ordering, function calls, ::class constants) and that guard()/preserve() behave as expected. If the round-trip diff is clean, risk is low.
Executives: A small, MIT-licensed library that lets our product safely edit Laravel configuration files automatically — the setup steps customers currently do by hand, badly. It converts our most error-prone onboarding instructions into a single command, which shortens time-to-first-value and reduces the configuration tickets our support team absorbs. Cost is negligible, it's a dependency not a platform bet, and it's constrained by design: credentials stay in environment variables and cannot be overwritten through our write paths. Engineering effort is measured in a spike plus one feature, not a project.
Engineering: It's a thin, focused AST layer over nikic/php-parser with a facade (write, writeMany, edit()->set/merge/replace/remove) plus preview for dry runs. Defaults are sensible for our threat model: env() calls are preserved, and guard() throws on protected mutations. Two things we own explicitly — where we call it (install/provisioning/migrations, never mid-request on a cached config) and how we call it (validate + snapshot + write, behind an admin permission, with preview surfaced as a diff for review). We pin the version, add contract tests against our real config files, and keep the call sites isolated behind one internal service so a fork or replacement is a small blast radius.
How can I help you explore Laravel packages today?