PHPackages                             wecodemore/wp-composer-config - 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. wecodemore/wp-composer-config

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wecodemore/wp-composer-config
=============================

Auto generate your wp-config as Composer Script

v1.0.9(11y ago)151014[1 issues](https://github.com/wecodemore/wp-composer-config/issues)MITPHPPHP &gt;=5.3.2

Since Oct 20Pushed 11y ago3 watchersCompare

[ Source](https://github.com/wecodemore/wp-composer-config)[ Packagist](https://packagist.org/packages/wecodemore/wp-composer-config)[ Docs](https://github.com/wecodemore/wp-composer-config)[ RSS](/packages/wecodemore-wp-composer-config/feed)WikiDiscussions master Synced yesterday

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

Auto generate your `wp-config.php`
==================================

[](#auto-generate-your-wp-configphp)

[![Latest Stable Version](https://camo.githubusercontent.com/cc1bf12d53e584dc300ccde79986703b70aadf5652a4eaa9b301b04af8d71822/68747470733a2f2f706f7365722e707567782e6f72672f7765636f64656d6f72652f77702d636f6d706f7365722d636f6e6669672f762f737461626c652e737667)](https://packagist.org/packages/wecodemore/wp-composer-config)[![Total Downloads](https://camo.githubusercontent.com/2039178805655a835676c4b69e5cd9bbd3fa26efa23f4ff85a45b99edc2babe1/68747470733a2f2f706f7365722e707567782e6f72672f7765636f64656d6f72652f77702d636f6d706f7365722d636f6e6669672f646f776e6c6f6164732e737667)](https://packagist.org/packages/wecodemore/wp-composer-config)[![Latest Unstable Version](https://camo.githubusercontent.com/6e9ae37d288c385f8e4e9e22a0d72da0f8430b70b9296cea476746a7b8067a8b/68747470733a2f2f706f7365722e707567782e6f72672f7765636f64656d6f72652f77702d636f6d706f7365722d636f6e6669672f762f756e737461626c652e737667)](https://packagist.org/packages/wecodemore/wp-composer-config)[![License](https://camo.githubusercontent.com/1908be73f90cec94b15d2a8688c542651896948687d5e1a287fecdcf01731eb8/68747470733a2f2f706f7365722e707567782e6f72672f7765636f64656d6f72652f77702d636f6d706f7365722d636f6e6669672f6c6963656e73652e737667)](https://packagist.org/packages/wecodemore/wp-composer-config)

Usage as Composer post-package-install script. Auto generation of `wp-config.php` files for WordPress installs. This package mostly is a convenience package that should make the build process easier.

What is it?
-----------

[](#what-is-it)

This package is a `wp-config.php` generator for WordPress that runs as *Composer Script*. It is based up on [Vance Lucas PHPDotEnv package](https://github.com/vlucas/phpdotenv) that offers a solution for adding a not version controlled/ignored `.env` file. The key/value data is made available as `getenv()`, `$_ENV` and `$_SERVER` variable afterwards. This config generator fetches a maintained list of configurable WordPress constants (like DB credentials) and builds a `wp-config.php` file in the WordPress root directory. This does not make increase security, but it helps preventing that you push sensitive information to a version controlled repository. It also makes it easier to maintain different environments like development, staging and production.

Example:

[![Example of the CLI process](https://camo.githubusercontent.com/9c94dc36e4d92e640a4b63cf6174768904f8f085dbdc059bbfaa9708fa579051/68747470733a2f2f63646e2e7261776769742e636f6d2f7765636f64656d6f72652f77702d636f6d706f7365722d636f6e6669672f6d61737465722f636f6d706f7365722d72756e2d7363726970742e676966)](https://camo.githubusercontent.com/9c94dc36e4d92e640a4b63cf6174768904f8f085dbdc059bbfaa9708fa579051/68747470733a2f2f63646e2e7261776769742e636f6d2f7765636f64656d6f72652f77702d636f6d706f7365722d636f6e6669672f6d61737465722f636f6d706f7365722d72756e2d7363726970742e676966)

How To: Setup
-------------

[](#how-to-setup)

We recommend to use something like Andreys/"[@Rarst](https://twitter.com/Rarst)" recipe for a [site stack](http://composer.rarst.net/recipe/site-stack) to get a thoughtful base structure for your project. Simply add this package to your stack.

```
"config" : {
	"vendor-dir": "wp-content/vendor"
},
// ...
"require" : {
	// ... other software installed to /var/www/wp-content/vendor
    "wecodemore/wp-composer-config" : "1.x-dev"
},

```

Then setup the script

```
"scripts" : {
	"post-package-install" : [
		"WCM\\WPComposerConfig\\WPConfigCommand::postPackageInstall"
	]
},

```

Finally the script needs some variable set for the `extra` object:

```
"extra"   : {
	"wordpress-install-dir" : "path/to/wordpress",
	"wordpress-env-dir"     : "path/to/the/.env/file
 }

```

That's it.

If you want to run it on demand, you might want to give it a custom name that you can refer to on the command line. Avoid `config` as this is an internal Composer command:

```
"scripts" : {
	"wp-config" : [
		"WCM\\WPComposerConfig\\WPConfigCommand::postPackageInstall"
	]
},

```

This way you can simply enter

```
composer wp-config

```

in your CLI and run it whenever it pleases you.

How To: Use it
--------------

[](#how-to-use-it)

The check list:

1. Make sure that you add `.env` to your `.gitignore` file
2. Take a look at the `/ci` folder in this package and copy the `.env.example` contents to your projects `.env` file. This is a blueprint of all major versions
3. Adjust the settings that you find there
4. Add the setup steps described above to your `composer.json` file
5. Open your CLI and enter `composer install`
6. Auth keys and Salt get fetched directly from the wordpess.org servers

#### Options

[](#options)

The following options are mirrored by the package over from PHPDotEnv:

**Comment:** Prefix a line with `#`.

**Empty string:** Set a `=` after your key without a value

The following option is new and only works for auto generating the `wp-config.php` file. This should make it easier to test different settings without adding and deleting the same constants over and over again.

**Use WP Default:** Set neither a `=`, nor a value for that key. Or just don't set it at all.

Internals
---------

[](#internals)

The package does not overwrite already existing Auth Keys and Salts. If you need them to be regenerated, please just delete them from the config by hand. They will get added again with a new set of hashes directly from wp.org.

FAQ
---

[](#faq)

#### **Q:** I need Multisite

[](#q-i-need-multisite)

**A:** Switching from the (default) single site install to a multi site install is a multi step process that involves user interaction, changing the `.htaccess` file and adding constants step by step. We don't want to mess up your repo, so we don't do that by now. But if you think you can make it happen, just fork the repo and send a Pull Request.

#### **Q:** Shall I install it from GitHub or from Packagist?

[](#q-shall-i-install-it-from-github-or-from-packagist)

**A:** The package is on Packagist and auto updated from GitHub instantly (using WebHooks).

#### **Q:** Will you implement X?

[](#q-will-you-implement-x)

**A:** Just ask in a new issue. We discuss everything with everyone. If you got a PR, even better.

#### **Q:** What version should I refer to in my `composer.json`?

[](#q-what-version-should-i-refer-to-in-my-composerjson)

**A:** We use [semantic versioning](http://semver.org/), so you will want to stay up to date with **major** versions.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 98.1% 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

Every ~34 days

Total

5

Last Release

4085d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3ec7d6330cea83c240e92bf0356e650a0e5f847497c4f3f0e38e16b4b0755b00?d=identicon)[wecodemore](/maintainers/wecodemore)

---

Top Contributors

[![franz-josef-kaiser](https://avatars.githubusercontent.com/u/387666?v=4)](https://github.com/franz-josef-kaiser "franz-josef-kaiser (52 commits)")[![ptica](https://avatars.githubusercontent.com/u/169873?v=4)](https://github.com/ptica "ptica (1 commits)")

---

Tags

composerwordpressconfigenvwpwp-config

### Embed Badge

![Health badge](/badges/wecodemore-wp-composer-config/health.svg)

```
[![Health](https://phpackages.com/badges/wecodemore-wp-composer-config/health.svg)](https://phpackages.com/packages/wecodemore-wp-composer-config)
```

###  Alternatives

[roots/bedrock

WordPress boilerplate with Composer, easier configuration, and an improved folder structure

6.5k441.8k2](/packages/roots-bedrock)[wecodemore/wpstarter

Composer plugin to easily build WordPress websites entirely managed via Composer.

253195.2k6](/packages/wecodemore-wpstarter)[ffraenz/private-composer-installer

A composer install helper for private packages

2331.7M5](/packages/ffraenz-private-composer-installer)[philippbaschke/acf-pro-installer

An install helper for Advanced Custom Fields PRO

283724.6k](/packages/philippbaschke-acf-pro-installer)

PHPackages © 2026

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