Download the PHP package devkit/env-profiles without Composer
On this page you can find all versions of the php package devkit/env-profiles. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download devkit/env-profiles
More information about devkit/env-profiles
Files in devkit/env-profiles
Package env-profiles
Short Description Save, switch, and diff .env profiles — named store, backups, gitignore hints, and drift reports.
License MIT
Informations about the package env-profiles
devkit-env-profiles
Named .env profiles, safe switching with backups, and drift reports — all from one Composer binary.
Table of Contents
- Why this exists
- Use case — switching environments in seconds
- Prerequisites
- Install
- Running the CLI
- Commands at a glance
- Configuration
- Files and folders
- Commands
saveuselistdeletediffmerge
- Library API
- Development
- Support
- License
Why this exists
Managing several environments usually means several files: .env, .env.staging, secrets in CI, and the nagging question — "does production still match what we think?"
This tool gives you a small profile store under your repo, a predictable use workflow (with backups and optional post-switch hooks), and a diff command to compare any set of env files side by side or as JSON.
Use case — switching environments in seconds
Imagine a typical Laravel app: local dev uses SQLite and the local filesystem, staging uses MySQL and S3-compatible storage, production uses RDS Aurora, S3, and a Redis queue. Without a tool like this, switching means manually editing .env, hunting down the right values, and hoping you didn't leave APP_DEBUG=true pointing at production.
With devkit-env-profiles:
Then switching is a single command — with an automatic backup and optional post-switch hooks (cache clear, migrations, etc.) running for you:
And when something feels off, diff tells you exactly what diverged:
The profiles live outside version control (auto-added to .gitignore) so secrets never accidentally land in your repo.
Prerequisites
| Requirement | Version |
|---|---|
| PHP | 8.3+ |
| Composer | any recent |
Install
From a clone of this repo
Running the CLI
The CLI resolves paths and .devkit-env.json relative to the directory you run it from. Always run from your application root (where composer.json and usually .env live).
Windows: use
vendor\bin\devkit-env.batorphp vendor\bin\devkit-env.
Commands at a glance
| Command | What it does |
|---|---|
save |
Snapshot ./.env (or --from) into a named profile. |
use |
Apply a saved profile to your working .env, with automatic backup. |
list |
Print all saved profile names. |
delete |
Remove a profile from the store (does not touch your live .env). |
diff |
Compare profiles or files; shows missing keys, extra keys, and value drift. |
merge |
Merge two env files or profiles; interactive or scriptable. |
Configuration
Drop a .devkit-env.json in your project root to customise store paths and post-switch hooks.
Note:
defaultEnvandtargetEnvonly affectuse. Whensaveruns without--from, it always reads./.env— not these keys.
| Key | Role |
|---|---|
storeDir |
Directory for saved profile files and registry.json. |
backupDir |
Where use stores timestamped backups of the replaced file. |
defaultEnv |
Path use writes a profile to (often .env). Relative unless absolute. |
targetEnv |
Same as defaultEnv; if both are set, targetEnv wins. |
afterSwitch |
Shell commands run after every successful use. |
afterSwitchProfiles |
Extra commands for specific profile names (runs after afterSwitch). |
Full hook example
Files and folders
On first save, use, list, or delete, the store and backups directories are automatically appended to .gitignore. You can safely commit .devkit-env.json (paths only) — keep secrets and env/ local.
Commands
save — snapshot a file into a named profile
Interactive (TTY): run
savewith no name to pick from a list or type a new one.
use — apply a profile to your working env file
Interactive (TTY): run
usewithout a name to pick from a numbered list.
list — show saved profile names
Prints one name per line, or (no profiles saved yet) if the store is empty.
delete — remove a profile from the store
Interactive (TTY): run
deletewithout a name to pick from a list.
diff — drift between env files
Compares a baseline against one or more targets: missing keys, extra keys, and mismatched values. Sensitive-looking values are masked by default.
Exit codes: 0 = no drift · 1 = drift found · 2 = error
merge — combine two .env files
--select keybindings
| Key | Action |
|---|---|
| `1`–`N` | Toggle item |
| `a` | Select all |
| `n` | Select none |
| `v` | Toggle value previews |
| `d` | Done |
| `q` | Cancel |
Library API
Most users only need the CLI. If you want to integrate programmatically:
| Namespace | Contents |
|---|---|
Devkit\Env\Diff\ |
Parsing, comparison, masking, report formatters. |
Devkit\Env\Store\ |
Config, profile save/apply/list/delete, registry, gitignore hooks, post-switch runner. |
Development
Support
If this project saves you time, consider buying me a coffee:
License
MIT