PHPackages                             amphibee/wp-cli-dotenv-command - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. amphibee/wp-cli-dotenv-command

ActiveWp-cli-package[CLI &amp; Console](/categories/cli)

amphibee/wp-cli-dotenv-command
==============================

Dotenv commands for WP-CLI

2.2.0(2y ago)010MITPHPPHP ^8.0|^8.1

Since Jun 30Pushed 2y agoCompare

[ Source](https://github.com/AmphiBee/wp-cli-dotenv-command)[ Packagist](https://packagist.org/packages/amphibee/wp-cli-dotenv-command)[ Docs](https://amphibee.fr)[ RSS](/packages/amphibee-wp-cli-dotenv-command/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

WP-CLI Dotenv Command
=====================

[](#wp-cli-dotenv-command)

[![Packagist](https://camo.githubusercontent.com/9b58becd72ea4d69790833aed4d66c1a3a6d7f504068d3c099d5550cdf6fcec2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616d7068696265652f77702d636c692d646f74656e762d636f6d6d616e642e737667)](https://packagist.org/packages/aaemnnosttv/wp-cli-dotenv-command)

```
NAME

  wp dotenv

DESCRIPTION

  Manage a .env file

SYNOPSIS

  wp dotenv

SUBCOMMANDS

  delete      Delete a definition from the environment file
  get         Get the value for a given key from the environment file
  init        Initialize the environment file
  list        List the defined variables from the environment file
  salts       Manage WordPress salts in .env format
  set         Set a value in the environment file for a given key.

```

> All `dotenv` commands accept a `--file=` parameter to specify the location of the environment file.
> Defaults to `.env`.
> If used, this parameter can be an absolute or relative path to the environment file, but which must include the file name (it does not have to be `.env`).

`init`
------

[](#init)

Initializes a new environment file.

By default, this command will only create the environment file if it does not already exist, but it can do much more.

#### `--template=`

[](#--templatefile)

You may optionally initialize the environment file using another file as a template (eg: `.env.example`, a common convention). Run `wp dotenv init --template=.env.example` to use that file as the basis for the new environment file.

By default, the new file will be a copy of the template, but you may also set new values on the fly interactively! Passing the `--interactive` flag with the same command will prompt for each defined variable in the template. You may specify a new value to use, or simply leave it blank to keep the template-defined value. Any other lines/comments from the template are preserved.

#### `--with-salts`

[](#--with-salts)

Initialize the new environment file with fresh salts provided by the wordpress.org salt generator service. Any existing keys by the same name will not be overwritten. [See `salts`](#salts).

#### `--force`

[](#--force)

Overwrites an existing environment file, if it exists.

`list [...]`
---------------------

[](#list-pattern)

Prints out all of the key/value pairs as defined in the environment file.

You may also optionally limit the output to specific keys, or even keys that match simple patterns using glob pattern syntax. Eg: `wp dotenv list DB_* *AWS*` would produce a list with the following hypotheical keys:

```
DB_NAME=...
DB_PASS=...
S3_AWS_ID=...
S3_AWS_SECRET=...

```

The `list` command supports all of the same options for `--format=` you've known to grow and love (`table`,`json`,`csv`,..etc). Default: `table`.

`get `
-----------

[](#get-key)

Get the value of a defined key from the environment file.

`set  `
-------------------

[](#set-key-value)

Set the value of a key in the environment file.

By default the value that is set is not quoted in the file. If you need your value to be quoted a certain way, you may optionally pass a flag for the preferred style of quote you want: `--quote-single` or `--quote-double`.

`delete ...`
-----------------

[](#delete-key)

Remove one or more definitions for the given keys from the environment file.

`salts`
-------

[](#salts)

#### `generate`

[](#generate)

Adds variable definitions to the environment file with fresh salts provided by the [wordpress.org salt generator service](https://api.wordpress.org/secret-key/1.1/salt/).

By default, any existing keys by the same name will not be overwritten. However, if all of the defined salts in the environment file have the same value, then it is assumed that they are placeholders and will be updated. It is also possible to force regenerate them using `--force`, or simply use the `regenerate` command (see below).

#### `regenerate`

[](#regenerate)

Same as `generate`, but will update all keys for salts with new values.

Installation
============

[](#installation)

#### Recommended

[](#recommended)

As of WP-CLI v0.23, you may install the dotenv command using the new `package` command:

```
wp package install amphibee/wp-cli-dotenv-command:^2.0

```

For installation with prior versions of WP-CLI, [see the wiki](https://github.com/amphibee/wp-cli-dotenv-command/wiki).

That's it! Now you should see the `dotenv` command as an option when you run `wp` from any directory.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1053d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8435080f3e74b629258f291a62cb72aa9d63ee44d74e588f594dc6378c328fa2?d=identicon)[amphibee](/maintainers/amphibee)

---

Top Contributors

[![ogorzalka](https://avatars.githubusercontent.com/u/149651?v=4)](https://github.com/ogorzalka "ogorzalka (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/amphibee-wp-cli-dotenv-command/health.svg)

```
[![Health](https://phpackages.com/badges/amphibee-wp-cli-dotenv-command/health.svg)](https://phpackages.com/packages/amphibee-wp-cli-dotenv-command)
```

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.0k17.2M320](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M19](/packages/consolidation-annotated-command)[chi-teck/drupal-code-generator

Drupal code generator

26947.8M5](/packages/chi-teck-drupal-code-generator)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
