PHPackages                             salaros/wp-cli-salts-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. salaros/wp-cli-salts-command

ActiveWp-cli-package[Utility &amp; Helpers](/categories/utility)

salaros/wp-cli-salts-command
============================

Manage salts for your WordPress installation

0.6.1(8y ago)31.0k1MITPHPPHP &gt;=5.4

Since Nov 11Pushed 8y agoCompare

[ Source](https://github.com/salaros/wp-cli-salts-command)[ Packagist](https://packagist.org/packages/salaros/wp-cli-salts-command)[ Docs](https://github.com/salaros/wp-cli-salts-command)[ RSS](/packages/salaros-wp-cli-salts-command/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (8)Used By (0)

WP-CLI Salt Command
===================

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

[![Package license](https://camo.githubusercontent.com/50d7e549d8367c0e43fdbf4e4bf8aada68f7728098d581f668179eb0cb3fbba3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73616c61726f732f77702d636c692d73616c74732d636f6d6d616e642e737667)](https://packagist.org/packages/salaros/wp-cli-salts-command)[![Packagist type](https://camo.githubusercontent.com/1460c92c606a2b9c28292b44834f790418b8c1476183dbac4f279311a0a3476d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5061636b61676973742d77702d2d636c692d2d7061636b6167652d70696e6b2e737667)](https://packagist.org/packages/salaros/wp-cli-salts-command)[![Packagist downloads](https://camo.githubusercontent.com/5f1c6cee0e44ec97c37b531ce0bec86527b9e230c8b44a0f398afde37f3c3dc7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73616c61726f732f77702d636c692d73616c74732d636f6d6d616e642e737667)](https://packagist.org/packages/salaros/wp-cli-salts-command)[![Monthly Downloads](https://camo.githubusercontent.com/09f47e044d054039045eb4224133c418db15182f6b34c089f4fcca9e34702c94/68747470733a2f2f706f7365722e707567782e6f72672f73616c61726f732f77702d636c692d73616c74732d636f6d6d616e642f642f6d6f6e74686c79)](https://packagist.org/packages/salaros/wp-cli-salts-command)[![Latest Stable Version](https://camo.githubusercontent.com/8f2a5d5fbc22cda5cf161cdaee64bafa2a24a2043f63fe0c584a804f7e1bef62/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73616c61726f732f77702d636c692d73616c74732d636f6d6d616e642e737667)](https://packagist.org/packages/salaros/wp-cli-salts-command)[![composer.lock](https://camo.githubusercontent.com/d019ab79cf308be654c992d05ccda634e085118ab387e231fb3b80aa88e3cd05/68747470733a2f2f706f7365722e707567782e6f72672f73616c61726f732f77702d636c692d73616c74732d636f6d6d616e642f636f6d706f7365726c6f636b)](https://packagist.org/packages/salaros/wp-cli-salts-command)

Manage salts for your WordPress installation

Output salts to STDOUT
----------------------

[](#output-salts-to-stdout)

```
wp salts generate # defaults to --format=php
wp salts generate --format=env
wp salts generate --format=yaml
```

This will grab new salts from the [WordPress Salt API](https://api.wordpress.org/secret-key/1.1/salt/) and output it to the `STDOUT`

Output salts to a file
----------------------

[](#output-salts-to-a-file)

### PHP file

[](#php-file)

```
wp salts generate --file=/absolute/path/to/file.php
```

This will output the salts to a file. Because the file contains the complete `define()` code the salts will be set by a simple `require` somewhere in your wp-config.php

### Environment variable file

[](#environment-variable-file)

```
wp salts generate --file=/absolute/path/to/.env
```

This will output the salts as shell environment variables (`MY_VAR=VALUE`). Useful for projects that [load configurations from .env files](https://github.com/vlucas/phpdotenv).

### Yaml config file

[](#yaml-config-file)

```
wp salts generate --file=/absolute/path/to/file.yaml
```

This will output the salts as [Yaml](https://en.wikipedia.org/wiki/YAML) config file.

Other examples
--------------

[](#other-examples)

Generally the file format can be desumed from file name / extension. However one can enforce Yaml format when it can't be detected automatically

```
wp salts generate --format=yaml --my.config
```

One could also append want to append some custom WordPress salts, such as `WP_CACHE_KEY_SALT` used by [Memcached Object Cache](https://github.com/Automattic/wp-memcached/blob/master/object-cache.php), [WP Redis](https://github.com/pantheon-systems/wp-redis/blob/c99e1e850ab28453d0fceac7d621dfbad94d1f0b/object-cache.php) and other plugins:

```
wp salts generate --format=env --append=WP_CACHE_KEY_SALT,OTHER_USEFUL_SALT

AUTH_KEY='|p/>=h19^l/tFT=_e yOu+_@Zs?VMUObx@@Gx2SD/rPFdb(?jBbpE~w+l-[r0rY]%#x1CvPqzFN[ (pTRNt1|p[RiFooj'
NONCE_KEY='SoBdx~Nh+FXhniyc7?oTY;|rjvLsTa!yV:Z-_z*Bs)`6z53ld^B4vVdqVJ&ass/u'
AUTH_SALT='hcSd}*.rYZ9g^!x{vYzD$4n0=|_5Lu#+)UNw`L`dF$w/`uP{&*xdI9&[`j^Q*3
