This library separates WordPress configuration constants from wp-config.php to .config file.
{
"require": {
"piotrpress/wordpress-config": "^3.0"
},
"scripts": {
"post-update-cmd": "php -r \"copy('vendor/piotrpress/wordpress-config/res/wp-config.php', 'wp-config.php');\""
}
}NOTE: if .config file doesn't exists, it'll be created automatically.
Fill in the missing configuration in .config file.
DB_NAME=wordpress
DB_USER="${USER}"
DB_PASSWORD="${PASS}"
DB_HOST=localhost
WP_DEBUG=true
WP_HOME="https://${SERVER_NAME}"
WP_CONTENT_DIR="${DOCUMENT_ROOT}/wp-content"NOTE: use ${...} syntax to return environment or server variable.
Check out example implementation in the piotrpress/wordpress package.
PHP >= 7.4 version.