PHPackages                             rbdwllr/wordpress-salts-generator - 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. rbdwllr/wordpress-salts-generator

ActiveLibrary[CLI &amp; Console](/categories/cli)

rbdwllr/wordpress-salts-generator
=================================

A key and salts generator for WordPress that works with both wp-config and .env files.

0.2.0(7y ago)945.5k↓11.9%8[2 PRs](https://github.com/RobDWaller/wordpress-salts-generator/pulls)2MITPHPPHP &gt;=7.0.0CI failing

Since Apr 3Pushed 6y ago1 watchersCompare

[ Source](https://github.com/RobDWaller/wordpress-salts-generator)[ Packagist](https://packagist.org/packages/rbdwllr/wordpress-salts-generator)[ RSS](/packages/rbdwllr-wordpress-salts-generator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (4)Versions (5)Used By (2)

WordPress Salts Generator
=========================

[](#wordpress-salts-generator)

A key and salts generator for WordPress that works with both wp-config and .env files.

- This library is for use with a composer setup of WordPress.
- Keys and salts are generated via the command line.

Installation
------------

[](#installation)

To install this library either use the composer require command.

```
composer require rbdwllr/wordpress-salts-generator 0.1.*

```

Or add it straight to your `composer.json` file and run `composer update`.

```
require: {
    "rbdwllr/wordpress-salts-generator": "0.1.*"
}

```

Commands
--------

[](#commands)

Their are two simple commands available for generating the keys and salts.

```
// Generates traditional WordPress 'define' keys and salts.
vendor/bin/wpsalts traditional

// Generates keys and salts that can be used in a .env file.
vendor/bin/wpsalts dotenv

```

If you don't add a command the `vendor/bin/wpsalts` command it will output the traditional WordPress salts and keys.

### Append to File

[](#append-to-file)

If you would like to append the keys directly to the end of an .env file you can use the `--clean` flag as follows.

```
vendor/bin/wpsalts dotenv --clean >> .env

```

The clean flag removes any messaging and formatting around the output, and the `>>` operator appends the output to the end of the .env file on a new line.

Output Examples
---------------

[](#output-examples)

### Traditional WordPress

[](#traditional-wordpress)

```
Copy and paste these keys and salts into your wp-config.php file.

define('AUTH_KEY', 'dva\uhm"cDc )euW2>^Ni$G%l&YC9'
AUTH_SALT = '$81GB@i@ 0qW@~
