2017 © Pedro Peláez
 

library wp-dotenv

Helper scripts to enable WordPress to use dotenv config files, similar to Laravel 5.

image

scottjs/wp-dotenv

Helper scripts to enable WordPress to use dotenv config files, similar to Laravel 5.

  • Thursday, January 26, 2017
  • by scottjs
  • Repository
  • 1 Watchers
  • 5 Stars
  • 3,046 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 16 Versions
  • 14 % Grown

The README.md

WP Dotenv

Inspired by Laravel 5, WP Dotenv enables WordPress to use .env files for its configuration instead of wp-config.php. This is useful if you're planning on using scottjs/db-sync or scottjs/helper-scripts with WordPress., (*1)

Requirements

  • Composer
  • PHP >= 5.3.9
  • A local development environment, such as Vagrant.

Notes

  • These scripts require a .env config file to be created in the project root, this file will be used to configure WordPress.
  • Running this script will replace the existing wp-config.php with a modified version to use the .env file.

Installation

Run composer require "scottjs/wp-dotenv:1.*" from the root of your project., (*2)

Alternatively, you can manually add "scottjs/wp-dotenv": "1.*" to your composer.json file:, (*3)

"require": {
    "scottjs/wp-dotenv": "1.*"
},

Then add the following scripts to your composer.json file:, (*4)

"scripts": {
    "generate-config" : [
        "vendor/scottjs/wp-dotenv/generate-config.sh"
    ],
    "generate-config-with-salts" : [
        "vendor/scottjs/wp-dotenv/generate-config.sh salts"
    ]
}

Run the composer update command from the root of your project., (*5)

Create a .env file in the root of your project and add/update the following configuration options:, (*6)

APP_DOCROOT=
APP_CORE=
APP_DEBUG=false
APP_WWW=false
APP_SSL=false

DB_HOST=localhost
DB_DATABASE=example
DB_USERNAME=root
DB_PASSWORD=password

Usage

From the root of your project, you will be able to run the following composer commands:, (*7)

  • composer generate-config - This command will generate a modified wp-config.php file to allow WordPress to use the .env file. This requires APP_DOCROOT to be set in the .env file., (*8)

  • composer generate-config-with-salts - As above, but will also generate the salts automatically. This is a handy command to use when starting a new project, but it can be used at any time., (*9)

Config

See below for an explanation of each configuration option used within the .env file., (*10)

  • APP_ENV - When set to local, the WordPress admin panel will display buttons in the admin panel to upgrade plugins and WordPress files. When set to production, the ability to plugins/software through the admin panel is disabled., (*11)

  • APP_DOCROOT - Required by composer generate-config, it should be relative to your project root folder and point to where the document root is configured. It should start with a slash and not include a trailing slash. Leave blank if not applicable. Example: /public., (*12)

  • APP_CORE - Required if WP core files are located in a subdirectory relative to APP_DOCROOT. It should point to the directory where WP core is installed. It should start with a slash and not include a trailing slash. Leave blank if not applicable. Example: /wp., (*13)

  • APP_DEBUG - Allows you to enable or disable WP debugging. Options: true or false., (*14)

  • APP_WWW - Allows you to force WordPress to redirect to www or non-www web addresses. Options: true or false., (*15)

  • APP_SSL - Allows you to force WordPress to use the SSL protocol and handle redirection. Options: true or false., (*16)

  • ***DB_**** - Provides options to set the local database connection details., (*17)

The Versions

26/01 2017

dev-master

9999999-dev

Helper scripts to enable WordPress to use dotenv config files, similar to Laravel 5.

  Sources   Download

MIT

The Requires

 

by Scott Salisbury

26/01 2017

1.1.0

1.1.0.0

Helper scripts to enable WordPress to use dotenv config files, similar to Laravel 5.

  Sources   Download

MIT

The Requires

 

by Scott Salisbury

26/01 2017

dev-develop

dev-develop

Helper scripts to enable WordPress to use dotenv config files, similar to Laravel 5.

  Sources   Download

MIT

The Requires

 

by Scott Salisbury

06/04 2016

1.0.2

1.0.2.0

Helper scripts to enable WordPress to use dotenv config files, similar to Laravel 5.

  Sources   Download

MIT

The Requires

 

by Scott Salisbury

06/04 2016

1.0.1

1.0.1.0

Helper scripts to enable WordPress to use dotenv config files, similar to Laravel 5.

  Sources   Download

MIT

The Requires

 

by Scott Salisbury

06/04 2016

1.0.0

1.0.0.0

Helper scripts to enable WordPress to use dotenv config files, similar to Laravel 5.

  Sources   Download

MIT

The Requires

 

by Scott Salisbury

03/04 2016

0.7.2

0.7.2.0

Helper scripts to enable WordPress to use dotenv config files, similar to Laravel 5.

  Sources   Download

MIT

The Requires

 

by Scott Salisbury

03/04 2016

0.7.1

0.7.1.0

Helper scripts to enable WordPress to use dotenv config files, similar to Laravel 5.

  Sources   Download

MIT

The Requires

 

by Scott Salisbury

03/04 2016

0.7.0

0.7.0.0

Helper scripts to enable WordPress to use dotenv config files, similar to Laravel 5.

  Sources   Download

MIT

The Requires

 

by Scott Salisbury

03/04 2016

0.6.1

0.6.1.0

  Sources   Download

The Requires

 

03/04 2016

0.6.0

0.6.0.0

  Sources   Download

The Requires

 

03/04 2016

0.5.0

0.5.0.0

  Sources   Download

The Requires

 

02/04 2016

0.4.0

0.4.0.0

  Sources   Download

The Requires

 

02/04 2016

0.3.0

0.3.0.0

  Sources   Download

The Requires

 

02/04 2016

0.2.0

0.2.0.0

  Sources   Download

The Requires

 

02/04 2016

0.1.0

0.1.0.0

  Sources   Download

The Requires