piotrpress/wordpress-config

This library separates WordPress configuration constants from wp-config.php to .config file.

v3.0.0 2023-05-04 17:13 UTC

This package is auto-updated.

Last update: 2024-05-04 19:43:39 UTC


README

This library separates WordPress configuration constants from wp-config.php to .config file.

Installation via composer.json 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.

Usage

Fill in the missing configuration in .config file.

Example

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.

Resources

Check out example implementation in the piotrpress/wordpress package.

Requirements

PHP >= 7.4 version.

License

MIT