Chapter 3. Configuration Adapters

For a basic understanding why adapters are useful, have a look at the configuration documentation.

You can build your own configuration adapter. Want to know how? Have a look at the extending phpbu section

Environment adapter "env"

Adapter to use environment variables for option values.

Example 3.1: Adapter definition

  <adapter type="env" name="myName"></adapter>

Example 3.2: Adapter reference

  <option name="password" value="adapter:myName:SOME_ENV_VAR" />

Dotenv adapter "dotenv"

Adapter to use .env files to load environment variables.

Table 3.1. Options

fileno.envPath to the .env file 

Example 3.3: Adapter definition

  <adapter type="dotenv" name="myName">
    <option name="file" value="my-dot-env-dir/.env"/>

Example 3.4: Adapter reference

  <option name="password" value="adapter:myName:SOME_DOTENV_VAR" />

PHP config adapter "array"

Adapter to use php array config files.

Example 3.5: Example PHP config file

<?php return ['foo' => ['bar' => 'baz']];

Table 3.2. Options

fileyes-Path to the php config file 

Example 3.6: Adapter definition

  <adapter type="array" name="myName">
    <option name="file" value="my-config-dir/config.php"/>

Example 3.7: Adapter reference

  <option name="password" value="" />

Please open a ticket on GitHub to suggest improvements to this page. Thanks!