ConfigureModule
Less than 1 minute
ConfigureModule
Console module for configuring the DBI database adapter.
class ConfigureModule extends \Hazaar\Console\DBI\ModuleInteractively prompts the user to select a PDO-compatible database driver and collects the connection parameters required for that driver, then writes the resulting configuration to the application's database.php config file.
Constants
ADAPTERS
private const ADAPTERS = array (
'PostgreSQL' =>
array (
'type' => 'pgsql',
'prompts' =>
array (
0 =>
array (
'key' => 'host',
'label' => 'Host',
'default' => 'localhost',
),
1 =>
array (
'key' => 'port',
'label' => 'Port',
'default' => '5432',
),
2 =>
array (
'key' => 'dbname',
'label' => 'Database name',
),
3 =>
array (
'key' => 'user',
'label' => 'Username',
),
4 =>
array (
'key' => 'password',
'label' => 'Password',
'secret' => true,
),
),
),
'MySQL' =>
array (
'type' => 'mysql',
'prompts' =>
array (
0 =>
array (
'key' => 'host',
'label' => 'Host',
'default' => 'localhost',
),
1 =>
array (
'key' => 'port',
'label' => 'Port',
'default' => '3306',
),
2 =>
array (
'key' => 'dbname',
'label' => 'Database name',
),
3 =>
array (
'key' => 'user',
'label' => 'Username',
),
4 =>
array (
'key' => 'password',
'label' => 'Password',
'secret' => true,
),
),
),
'SQLite' =>
array (
'type' => 'sqlite',
'prompts' =>
array (
0 =>
array (
'key' => 'file',
'label' => 'Database file path',
'default' => '.runtime/database.db',
),
),
),
)Methods
configure
Registers the configure command.
protected configure(): voidexecute
Runs the interactive configuration wizard and writes the config file.
protected execute(Input $input, Output $output): intParameters
| Parameter | Type | Description |
|---|---|---|
$input | Input | parsed command input |
$output | Output | console output writer |
buildPhpConfig
Renders a PHP config array as a formatted PHP source file string.
private buildPhpConfig(array $config): stringParameters
| Parameter | Type | Description |
|---|---|---|
$config | array | the full multi-environment config array |
formatValue
Formats a config value for stable PHP output with consistent indentation.
private formatValue(mixed $value, int $indentLevel): stringParameters
| Parameter | Type | Description |
|---|---|---|
$value | mixed | value to format |
$indentLevel | int | indentation level in 4-space units |
Generated by Hazaar API Doc Generator on Wed, 22 Jul 2026 14:10:07 +0000