lionix/envclient
Laravel package for working with .env files programmatically: read, update, and manage environment variables from your app or an admin panel, so configuration changes can be made without manual file editing or redeploys.
php artisan pre-flight check before release promotion. Release 2.2.0 materially strengthens this: validate_on_boot (log or exception) plus ready-made rule sets (AppRules, DatabaseRules, MailRules, QueueRules, RedisRules, AwsRules) mean a baseline validation policy is now configuration rather than code we write.env() guard rails, ad-hoc config assertions, or a check-env script. Adopting a small MIT-licensed package with validation rules and a fluent client replaces bespoke glue at near-zero cost — a clear "buy/adopt" over "build." The 2.2.0 rule sets and env:diff/env:sync shift the build-vs-adopt math further toward adopt, since the two most commonly hand-rolled scripts (drift check, .env.example reconciliation) now ship in the box.env:diff and env:sync compare and reconcile .env against .env.example, and --file lets a single command operate on a different environment file. That converts "surface missing or divergent keys" from a custom script into a repeatable operation — relevant if the roadmap includes multi-environment, multi-tenant, or white-label deployments where each tenant may carry its own env file..env.example accuracy a solved problem rather than tribal knowledge — and env:diff/env:sync make it a maintained invariant rather than a one-time cleanup. env:generate listing the (masked) values it writes further reduces first-run guesswork.EnvironmentFileUpdated and EnvironmentVariablesGenerated events give an audit trail hook for every env mutation, and automatic <file>.backup copies plus env:restore provide a rollback story — both meaningful upgrades for change-review controls, though still a lightweight first step, not a control framework.Reasonable fit when:
env()/config() calls..env files (env:set, env:unset, env:sync, env:restore), not just reads them.env:encrypt and want to inspect or update encrypted files without writing decrypted contents to disk (--encrypted, --key, --cipher).Look elsewhere when:
Adoption guardrails (updated for 2.2.0):
validate_on_boot as a production-change control, not a checkbox. Validating on every web request puts a third-party package on the hot path with outage potential. Start in log mode to gather signal, and only consider exception after the schema has proven stable in staging for at least a full release cycle. Never enable exception mode on a service where a schema false-positive would take down traffic.env:get masks secret values by default; any existing script or CI job reading secrets must add --reveal. Inventory dependents before upgrading, and prefer passing --reveal only inside trusted jobs rather than broadly..backup files, --reveal output, and env:set writing values to disk all extend the footprint of plaintext secrets on the filesystem. Mandate gitignore coverage for *.backup and targeted env files, restrict file permissions, and confirm backups are excluded from build artifacts and log shipping before enabling backup in shared environments.illuminate/encryption is now a direct dependency and saving a file updates the runtime environment for the rest of the request or command — verify this behaviour doesn't surprise long-running workers or code that caches config at boot.For executives (one paragraph): A meaningful share of production incidents and failed releases trace back to misconfigured environment variables — a missing key, a typo'd value, a variable that exists in staging but not production. This package lets us validate, diff, and reconcile that configuration with standard tooling before a deploy happens, turning a recurring class of outage into a caught-before-release error. The latest release adds prebuilt validation rule sets for the services we actually run, secret masking by default, encrypted-file support, and an event/rollback trail for every change — meaningfully closing the gap between "useful utility" and "controlled operational tool." It is MIT-licensed, integrates natively with our Laravel stack, and costs effectively nothing to trial. The recommendation is a bounded pilot in one service, starting in non-blocking validation mode, to measure impact on failed deployments and onboarding time — not a platform-wide mandate, given the project's small maintainer base.
For engineering leads: You get artisan commands to inspect, validate, diff, sync, and roll back env state; prebuilt rule sets for app, database, mail, queue, Redis, and AWS; --file support for per-environment or per-tenant files; encrypted-file read/write without decrypted copies on disk; and a fluent client for reading configuration safely in tests and health checks. Masked-by-default output and EnvironmentFileUpdated/EnvironmentVariablesGenerated events give you an audit trail for free. Integration is a Composer dependency and a small config file. Caveats to plan around: (1) env:get now masks secrets by default in 2.2.0 — scripts reading secrets need --reveal, so audit dependents before upgrading; (2) validate_on_boot puts validation on every request, so start in log mode and treat exception as a deliberate, staged decision; (3) the package now writes to .env and creates .backup copies, which means plaintext secrets on disk — gitignore and permissions need to be explicit; (4) it remains a small, young package with no downstream dependents, so pin the version, isolate it behind an internal adapter, and keep the validation schema in our own repo so we can migrate to an in-house or platform-native solution if maintenance lapses. It complements, and does not replace, our secrets manager.
How can I help you explore Laravel packages today?