Skip to content
This repository has been archived by the owner on Dec 11, 2021. It is now read-only.

pascaliske/wp-config

Repository files navigation

pi/wp-config

Build Status

Package for easy WordPress configurations

A composer package which abstracts the standard wordpress configuration and enables the usage of environment based .yml files.

Install

You have to add the following to your composer.jsons repositories:

{
  "type": "composer",
  "url" : "https://dev.pascal-iske.de/packages/"
}

And then you can just require the package:

$ composer require pi/wp-config

Usage

Create the following folder structure:

$ tree conf
conf
├── development
├── production
└── staging

3 directories, 0 files

In your WordPress config require the composer autoload file and then you can initialize the config setup:

// map urls to specific environments
$urls = new PI\Configuration\UrlSet();
$urls->set('production', '<production-domain>');
$urls->set('staging', '<staging-domain>');
$urls->set('development', array(
    '<local-domain>',
    '<other-domain>',
));

// access your environment and configuration
$env = new PI\Configuration\Environment($urls);
$config = $env->config();

$env->version; // returns the version string from composer file
$config->get('file:key:subkey'); // returns the value for the given key path

License

MIT © Pascal Iske