artprima/ixa-wp-config

此包已被废弃,不再维护。未建议替代包。

WordPress 配置器替代品

0.2 2014-02-17 17:39 UTC

This package is auto-updated.

Last update: 2020-10-19 21:50:52 UTC


README

确保 WordPress 配置在各个环境中保持一致。

安装

可以使用 Composer 进行安装

$ composer require ixa/wp-config 0.2

用法

Ixa Wp-Config 适用于在 wp-config.php 文件中使用,这是推荐的使用方式

use Ixa\WordPress\Configuration\Config;

require_once 'vendor/autoload.php';

// Load Config from config/ folder
$config = new Config(dirname(__FILE__) . '/config');
$config->load();

// ... define all variables and require wp-settings

````

## Configuration Folder

Ixa Wp-Config requires to define a folder in which the configuration will be placed.


### Environment Configuration

The configuration folder must contain a file named `.env.yml` with the following variables. 


````yaml
parameters:
  
  # Environment
  environment:    dev

  # Database Credentials
  db_name:        wordpress
  db_user:        root
  db_password:    ""
  db_host:        localhost

  # Site URL
  wp_home:        http://:1234/

````

All variables are required and must be placed under `parameters`. This is because the `.env.yml`  file can be generated dynamically using [Incenteev/ParameterHandler](https://github.com/Incenteev/ParameterHandler).